Description
Is is possible to create a index of datetime.datetime, without being auto converted to a DatetimeIndex containing Timestamp's? Even though datetime.datetime is not efficient, I thought the user should have a choice of using it for backward compatibility.
I wrote a lot of code using Index containing timezone-aware datetime.datetime. This caused me a lot of headache when I tried to port my codes from 07.3 to 10.1.
I also encountered several weird bugs (in 10.1).
(I) When DatetimeIndex is assigned as a column of a DataFrame, a silent error occurs:
In [1]: from pandas import *
In [2]: a = date_range('20130101', periods=3, tz='US/Eastern')
In [3]: b = date_range('20130215', periods=3, tz='US/Eastern')
In [4]: Series(a, b) #works as expected
Out[4]:
2013-02-15 00:00:00-05:00 2013-01-01 05:00:00
2013-02-16 00:00:00-05:00 2013-01-02 05:00:00
2013-02-17 00:00:00-05:00 2013-01-03 05:00:00
Freq: D
In [5]: DataFrame({'a': a}, b) #???
Out[5]:
a
2013-02-15 00:00:00-05:00 1970-01-18 05:00:00
2013-02-16 00:00:00-05:00 1970-01-19 05:00:00
2013-02-17 00:00:00-05:00 1970-01-20 05:00:00
(II) concat two Series will result in an incorrect DatetimeIndex:
In [18]: dates_a = [Timestamp('20130219 13:00', tz='US/Eastern'), Timestamp('20130220 13:00', tz='US/Eastern')]
In [19]: dates_b = [Timestamp('20130222 13:00', tz='US/Eastern'), Timestamp('20130223 13:00', tz='US/Eastern')]
In [20]: a = Series(range(2), dates_a)
In [21]: b = Series(range(2), dates_b)
In [22]: concat([a, b])
Out[22]:
2013-02-19 18:00:00-05:00 0
2013-02-20 18:00:00-05:00 1
2013-02-22 18:00:00-05:00 0
2013-02-23 18:00:00-05:00 1
Note that the index of Out[22] is wrong (time shifted by 5 hours).