A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/7795 below:

concat of objects with the same timezone get reset to UTC · Issue #7795 · pandas-dev/pandas · GitHub

Skip to content Navigation Menu

Saved searches Use saved searches to filter your results more quickly

Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert Additional navigation options

BUG: concat of objects with the same timezone get reset to UTC #7795

Description

http://stackoverflow.com/questions/24830952/changing-timezone-on-pandas-datetimeindex-when-concatenating-dataframes-in-pytho

ix1 = pd.DatetimeIndex(start=pd.Timestamp('20140715', tz='EST5EDT'), end=pd.Timestamp('20140717', tz='EST5EDT'), freq='D', tz='EST5EDT')
ix2 = pd.DatetimeIndex([pd.Timestamp('2014-07-11 00:00:00', tz='EST5EDT'), pd.Timestamp('2014-07-21 00:00:00', tz='EST5EDT')])
df1 = pd.DataFrame(0, index=ix1, columns=['A', 'B'])
df2 = pd.DataFrame(0, index=ix2, columns=['A', 'B'])

I think the because the 2nd index is only length 2 its freq is not inferred causing a reset to UTC.

In [46]: concat([df1,df2])
Out[46]: 
                           A  B
2014-07-15 04:00:00+00:00  0  0
2014-07-16 04:00:00+00:00  0  0
2014-07-17 04:00:00+00:00  0  0
2014-07-11 04:00:00+00:00  0  0
2014-07-21 04:00:00+00:00  0  0

In [47]: concat([df1,df2]).index
Out[47]: 
<class 'pandas.tseries.index.DatetimeIndex'>
[2014-07-15 04:00:00+00:00, ..., 2014-07-21 04:00:00+00:00]
Length: 5, Freq: None, Timezone: UTC

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4