AlenkaF commented on code in PR #38065:
URL: https://github.com/apache/arrow/pull/38065#discussion_r1350024520
##########
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:
Yeah, that was my thought but was not sure 😊 But here it is:
https://github.com/apache/arrow/blob/76f987eb94d2832bc959de455847a03387cab41a/python/pyarrow/types.pxi#L4486-L4489
Will remove 👍
##########
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:
Yeah, that was my thought but was not sure 😊 But here it is:
https://github.com/apache/arrow/blob/76f987eb94d2832bc959de455847a03387cab41a/python/pyarrow/types.pxi#L4486-L4489
Will remove 👍
--
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]