Skip to content

Error in Timezone handling of DataFrames when joined #2317

@lterry-t

Description

@lterry-t

When joining two DataFrames with localized indexes, the resulting DataFrame has erroneous Timestamps. (It appears that at some point the timestamps are interpreted at UTC without a correct timezone correction?)

Sample code:

In [94]: test1 = pandas.DataFrame(numpy.zeros((6,3)),index=pandas.tseries.index.date_range("2012-11-15 00:00:00", periods=6, freq="100L", tz="US/Central"))

In [95]: test2 = pandas.DataFrame(numpy.zeros((3,3)),index=pandas.tseries.index.date_range("2012-11-15 00:00:00", periods=3, freq="250L", tz="US/Central"), columns=range(3,6))

In [96]: test1
Out[96]:
                                  0  1  2
2012-11-15 00:00:00-06:00         0  0  0
2012-11-15 00:00:00.100000-06:00  0  0  0
2012-11-15 00:00:00.200000-06:00  0  0  0
2012-11-15 00:00:00.300000-06:00  0  0  0
2012-11-15 00:00:00.400000-06:00  0  0  0
2012-11-15 00:00:00.500000-06:00  0  0  0

In [97]: test2
Out[97]:
                                  3  4  5
2012-11-15 00:00:00-06:00         0  0  0
2012-11-15 00:00:00.250000-06:00  0  0  0
2012-11-15 00:00:00.500000-06:00  0  0  0

In [98]: test1.join(test2, how="outer")
Out[98]:
                                   0   1   2   3   4   5
2012-11-15 06:00:00-06:00          0   0   0   0   0   0
2012-11-15 06:00:00.100000-06:00   0   0   0 NaN NaN NaN
2012-11-15 06:00:00.200000-06:00   0   0   0 NaN NaN NaN
2012-11-15 06:00:00.250000-06:00 NaN NaN NaN   0   0   0
2012-11-15 06:00:00.300000-06:00   0   0   0 NaN NaN NaN
2012-11-15 06:00:00.400000-06:00   0   0   0 NaN NaN NaN
2012-11-15 06:00:00.500000-06:00   0   0   0   0   0   0

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions