jorisvandenbossche commented on code in PR #38065:
URL: https://github.com/apache/arrow/pull/38065#discussion_r1350012894


##########
python/pyarrow/interchange/column.py:
##########
@@ -312,7 +312,12 @@ def _dtype_from_arrowdtype(
             return kind, bit_width, f_string, Endianness.NATIVE
         elif pa.types.is_dictionary(dtype):
             kind = DtypeKind.CATEGORICAL
-            f_string = "L"
+            arr = self._col
+            indices_dtype = arr.indices.type
+            _, f_string = _PYARROW_KINDS.get(indices_dtype, (None, None))
+            if f_string is None:
+                raise ValueError(
+                    f"Data type {indices_dtype} not supported by interchange 
protocol")

Review Comment:
   In theory this should never happen, right? (because we know that our indices 
types are supported by the protocol and are inside `_PYARROW_KINDS`) Then it 
could also be simplified a bit.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to