You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "David Li (Jira)" <ji...@apache.org> on 2021/11/03 12:38:00 UTC

[jira] [Commented] (ARROW-14569) [C++][Python] Support for pandas Categoricals with Intervals

    [ https://issues.apache.org/jira/browse/ARROW-14569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17438030#comment-17438030 ] 

David Li commented on ARROW-14569:
----------------------------------

Looks like we need a cast from dictionary<extension> to extension (at least just looking at the error).

> [C++][Python] Support for pandas Categoricals with Intervals
> ------------------------------------------------------------
>
>                 Key: ARROW-14569
>                 URL: https://issues.apache.org/jira/browse/ARROW-14569
>             Project: Apache Arrow
>          Issue Type: New Feature
>          Components: C++, Python
>    Affects Versions: 6.0.0
>            Reporter: Alberto Torres
>            Priority: Minor
>              Labels: kernel
>
> Trying to write a pandas categorical created from `pd.cut` fails with the following error:
> {code:python}
> df_test = pd.DataFrame({"cat": pd.cut([1, 2, 3, 4, 5], bins=[2, 4])})
> df_test.to_parquet("test.parquet")
> {code}
> {code:python}
> File "pyarrow/error.pxi", line 120, in pyarrow.lib.check_status
> pyarrow.lib.ArrowNotImplementedError: Unsupported cast from dictionary<values=extension<pandas.interval<ArrowIntervalType>>, indices=int8, ordered=1> to extension<pandas.interval<ArrowIntervalType>> (no available cast function for target type)
> {code}
> The problems seems to be the interval dtype. Specifing the `labels` keyword solved the problem.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)