Closed
Description
All the same issue
- Printing None and NaN values in Pandas dataframe produces confusing results #12045
- str(data_frame) raises an exception when there is a column with both NaT value and Timestamp with timezone info #12211
In [1]: import datetime
In [2]: s = pd.Series([datetime.datetime(2012, 1, 1)]*10 + [datetime.datetime(1012,1,2)] + [datetime.datetime(2012, 1, 3)]*10)
In [8]: s
Out[8]:
0 2012-01-01 00:00:00
1 2012-01-01 00:00:00
2 2012-01-01 00:00:00
3 2012-01-01 00:00:00
4 2012-01-01 00:00:00
5 2012-01-01 00:00:00
6 2012-01-01 00:00:00
7 2012-01-01 00:00:00
8 2012-01-01 00:00:00
9 2012-01-01 00:00:00
10 1012-01-02 00:00:00
11 2012-01-03 00:00:00
12 2012-01-03 00:00:00
13 2012-01-03 00:00:00
14 2012-01-03 00:00:00
15 2012-01-03 00:00:00
16 2012-01-03 00:00:00
17 2012-01-03 00:00:00
18 2012-01-03 00:00:00
19 2012-01-03 00:00:00
20 2012-01-03 00:00:00
dtype: object
In [9]: pd.options.display.max_rows = 8
In [10]: s
Out[10]:
0 2012-01-01
1 2012-01-01
2 2012-01-01
3 2012-01-01
...
17 2012-01-03
18 2012-01-03
19 2012-01-03
20 2012-01-03
dtype: datetime64[ns]
In [11]: s.dtype
Out[11]: dtype('O')
So in some cases, you think you have a datetime64
series, but actually you don't and eg dt
properties don't work which can lead to quite some confusion ... :-)