You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "Wes McKinney (JIRA)" <ji...@apache.org> on 2018/01/07 17:29:03 UTC

[jira] [Resolved] (ARROW-1958) [Python] Error in pandas conversion for datetimetz row index

     [ https://issues.apache.org/jira/browse/ARROW-1958?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wes McKinney resolved ARROW-1958.
---------------------------------
    Resolution: Fixed

Issue resolved by pull request 1454
[https://github.com/apache/arrow/pull/1454]

> [Python] Error in pandas conversion for datetimetz row index
> ------------------------------------------------------------
>
>                 Key: ARROW-1958
>                 URL: https://issues.apache.org/jira/browse/ARROW-1958
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: Python
>    Affects Versions: 0.8.0
>         Environment: Ubuntu 16.04
>            Reporter: Albert Shieh
>            Assignee: Albert Shieh
>              Labels: pull-request-available
>             Fix For: 0.9.0
>
>
> The pandas conversion of a datetimetz row index in a Table fails with non-UTC time zones because the values are stored as datetime64\[ns\] and interpreted as datetime64\[ns, tz\], rather than interpreted as datetime64\[ns, UTC\] and converted to datetime64\[ns, tz\]. There's correct handling for time zones for columns in Column.to_pandas, but not for the row index in table_to_blockmanager.
> This is a minimal example demonstrating the failure of a roundtrip between a DataFrame and a Table:
> {code}
> import pandas as pd
> import pyarrow as pa
> df = pd.DataFrame({
>     'a': pd.date_range(
>         start='2017-01-01', periods=3, tz='America/New_York'
>     )
> })
> df = df.set_index('a')
> df_pa = pa.Table.from_pandas(df).to_pandas()
> print(df)
> print(df_pa)
> {code}
> The output is:
> {noformat}
> Empty DataFrame
> Columns: []
> Index: [2017-01-01 00:00:00-05:00, 2017-01-02 00:00:00-05:00, 2017-01-03 00:00:00-05:00]
> Empty DataFrame
> Columns: []
> Index: [2017-01-01 05:00:00-05:00, 2017-01-02 05:00:00-05:00, 2017-01-03 05:00:00-05:00]
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)