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
This may be related to #3950 though my symptoms are a bit different. In that issue, the tzinfo was lost during the creation of a MultiIndex array. In my case, I'm able to create a MultiIndex array with intact tzinfo, but tzinfo gets lost when I concatenate one or more such arrays.
Here's an example. Note the lack of tzinfo in the final line:
In [47]: importpandasIn [48]: importdatetimeIn [49]: importpytzIn [50]: array=pandas.DataFrame({'a':[datetime.datetime(2014,1,1,tzinfo=pytz.UTC), datetime.datetime(2014,1,2,tzinfo=pytz.UTC)], 'b':[1, 2], 'c':[3, 4]})
In [51]: a2=array.set_index('a')
In [52]: a3=array.set_index(['a', 'b'])
In [53]: a2_concatenated=pandas.concat([a2])
In [54]: a3_concatenated=pandas.concat([a3])
In [55]: array.iloc[0,0]
Out[55]: datetime.datetime(2014, 1, 1, 0, 0, tzinfo=<UTC>)
In [56]: a2.index[0]
Out[56]: Timestamp('2014-01-01 00:00:00+0000', tz='UTC')
In [57]: a3.index[0]
Out[57]: (Timestamp('2014-01-01 00:00:00+0000', tz='UTC'), 1)
In [58]: a2_concatenated.index[0]
Out[58]: Timestamp('2014-01-01 00:00:00+0000', tz='UTC')
In [59]: a3_concatenated.index[0]
Out[59]: (Timestamp('2014-01-01 00:00:00', tz=None), 1)
The text was updated successfully, but these errors were encountered:
I may be able to supply a fix but haven't dug into the underlying code yet.
An additional observation: Even just calling reset_index() on a MultiIndex array causes the tz offset to disappear:
In [70]: a3Out[70]:
cab2014-01-0100:00:00+00:00132014-01-0200:00:00+00:0024In [71]: a3.reset_index()
Out[71]:
abc02014-01-0100:00:001312014-01-0200:00:0024
This may be related to #3950 though my symptoms are a bit different. In that issue, the tzinfo was lost during the creation of a MultiIndex array. In my case, I'm able to create a MultiIndex array with intact tzinfo, but tzinfo gets lost when I concatenate one or more such arrays.
Here's an example. Note the lack of tzinfo in the final line:
The text was updated successfully, but these errors were encountered: