[jira] [Assigned] (ARROW-2646) [Python] Pandas roundtrip for date objects
[ https://issues.apache.org/jira/browse/ARROW-2646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Krisztian Szucs reassigned ARROW-2646: -- Assignee: Krisztian Szucs (was: Uwe L. Korn) > [Python] Pandas roundtrip for date objects > -- > > Key: ARROW-2646 > URL: https://issues.apache.org/jira/browse/ARROW-2646 > Project: Apache Arrow > Issue Type: Bug > Components: Python >Affects Versions: 0.9.0 >Reporter: Florian Jetter >Assignee: Krisztian Szucs >Priority: Minor > Labels: pull-request-available > Fix For: 0.11.0 > > Time Spent: 20m > Remaining Estimate: 0h > > Arrow currently casts date objects to nanosecond precision datetime objects. > I'd like to have a way to preserve the type during a roundtrip > {code} > >>> import pandas as pd > >>> import pyarrow as pa > >>> import datetime > >>> pa.date32().to_pandas_dtype() > dtype(' >>> df = pd.DataFrame({'date': [datetime.date(2018, 1, 1)]}) > >>> df.dtypes > date object > dtype: object > >>> df_rountrip = pa.Table.from_pandas(df).to_pandas() > >>> df_rountrip.dtypes > datedatetime64[ns] > dtype: object > {code} > I'd expect something like this to work: > {code} > >>> import pandas.testing as pdt > >>> df_rountrip = pa.Table.from_pandas(df).to_pandas(date_as_object=True) > >>> pdt.assert_frame_equal(df_rountrip, df) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Assigned] (ARROW-2646) [Python] Pandas roundtrip for date objects
[ https://issues.apache.org/jira/browse/ARROW-2646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Uwe L. Korn reassigned ARROW-2646: -- Assignee: Uwe L. Korn > [Python] Pandas roundtrip for date objects > -- > > Key: ARROW-2646 > URL: https://issues.apache.org/jira/browse/ARROW-2646 > Project: Apache Arrow > Issue Type: Bug > Components: Python >Affects Versions: 0.9.0 >Reporter: Florian Jetter >Assignee: Uwe L. Korn >Priority: Minor > Fix For: 0.11.0 > > > Arrow currently casts date objects to nanosecond precision datetime objects. > I'd like to have a way to preserve the type during a roundtrip > {code} > >>> import pandas as pd > >>> import pyarrow as pa > >>> import datetime > >>> pa.date32().to_pandas_dtype() > dtype(' >>> df = pd.DataFrame({'date': [datetime.date(2018, 1, 1)]}) > >>> df.dtypes > date object > dtype: object > >>> df_rountrip = pa.Table.from_pandas(df).to_pandas() > >>> df_rountrip.dtypes > datedatetime64[ns] > dtype: object > {code} > I'd expect something like this to work: > {code} > >>> import pandas.testing as pdt > >>> df_rountrip = pa.Table.from_pandas(df).to_pandas(date_as_object=True) > >>> pdt.assert_frame_equal(df_rountrip, df) > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)