You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Rok Mihevc (Jira)" <ji...@apache.org> on 2023/01/11 07:17:03 UTC

[jira] [Commented] (ARROW-1732) [Python] RecordBatch.from_pandas fails on DataFrame with no columns when preserve_index=False

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

Rok Mihevc commented on ARROW-1732:
-----------------------------------

This issue has been migrated to [issue #17737|https://github.com/apache/arrow/issues/17737] on GitHub. Please see the [migration documentation|https://github.com/apache/arrow/issues/14542] for further details.

> [Python] RecordBatch.from_pandas fails on DataFrame with no columns when preserve_index=False
> ---------------------------------------------------------------------------------------------
>
>                 Key: ARROW-1732
>                 URL: https://issues.apache.org/jira/browse/ARROW-1732
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>            Reporter: Wes McKinney
>            Assignee: Wes McKinney
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.8.0
>
>
> I believe this should have well-defined behavior and not raise an error:
> {code}
> In [5]: pa.RecordBatch.from_pandas(pd.DataFrame({}), preserve_index=False)
> ---------------------------------------------------------------------------
> ValueError                                Traceback (most recent call last)
> <ipython-input-5-4dda72b47dbd> in <module>()
> ----> 1 pa.RecordBatch.from_pandas(pd.DataFrame({}), preserve_index=False)
> ~/code/arrow/python/pyarrow/table.pxi in pyarrow.lib.RecordBatch.from_pandas (/home/wesm/code/arrow/python/build/temp.linux-x86_64-3.5/lib.cxx:39957)()
>     586             df, schema, preserve_index, nthreads=nthreads
>     587         )
> --> 588         return cls.from_arrays(arrays, names, metadata)
>     589 
>     590     @staticmethod
> ~/code/arrow/python/pyarrow/table.pxi in pyarrow.lib.RecordBatch.from_arrays (/home/wesm/code/arrow/python/build/temp.linux-x86_64-3.5/lib.cxx:40130)()
>     615 
>     616         if not number_of_arrays:
> --> 617             raise ValueError('Record batch cannot contain no arrays (for now)')
>     618 
>     619         num_rows = len(arrays[0])
> ValueError: Record batch cannot contain no arrays (for now)
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)