In 0.19.1 appending a DateTimeIndex to another DateTimeIndex where they have different time zones now returns an Index object. In 0.18.1 it would return a DateTimeIndex with a UTC time zone.
In 0.19.1 (and in 0.18.1) if the two DateTimeIndex have the same time zone a DateTimeIndex is returned. I believe the behavior in 0.18.1 of returning a DateTimeIndex with time zone UTC should be the correct behavior.
--- Example of the problem ---
import pandas as pd
df1 = pd.DataFrame({'a': [1, 2, 3]}, index=pd.date_range('1990-02-01 09:00:00', periods=3, freq='1min', tz='America/New_York'))
df2 = pd.DataFrame({'a': [4, 5, 6]}, index=pd.date_range('1990-02-01 08:03:00', periods=3, freq='1min', tz='America/Chicago'))
print(df1.index.tzinfo) # America/New_York
print(df2.index.tzinfo) # America/Chicago
result = df1.index.append(df2.index)
print(type(new_index))
print(type(result))
>> pandas 0.18.1 returns <class 'pandas.tseries.index.DatetimeIndex'>
>> pandas 0.19.1 returns <class 'pandas.indexes.base.Index'>
Comment From: jreback
Appending different timezones and coercing to UTC loses information. It is up to the user to explicitly coerce to the same timezone if you don't want this behavior. Having mixed timezones within a single object is only supported with boxed objects, hence the object
dtype.
This what fixed in #13360 / xref issue was #7795
In [16]: result.tolist()
Out[16]:
[Timestamp('1990-02-01 09:00:00-0500', tz='America/New_York', freq='T'),
Timestamp('1990-02-01 09:01:00-0500', tz='America/New_York', freq='T'),
Timestamp('1990-02-01 09:02:00-0500', tz='America/New_York', freq='T'),
Timestamp('1990-02-01 08:03:00-0600', tz='America/Chicago', freq='T'),
Timestamp('1990-02-01 08:04:00-0600', tz='America/Chicago', freq='T'),
Timestamp('1990-02-01 08:05:00-0600', tz='America/Chicago', freq='T')]
from above.