pandas.to_datetime called on existing datetime64 Series results in bad data · Issue #2699 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@wesm

Description

@wesm


In [7]: df.date
Out[7]: 
0    2007-10-29 00:00:00
1    2007-10-30 00:00:00
2    2007-10-31 00:00:00
3    2007-11-01 00:00:00
4    2007-11-02 00:00:00
5    2007-11-05 00:00:00
6    2007-11-06 00:00:00
7    2007-11-07 00:00:00
8    2007-11-08 00:00:00
9    2007-11-09 00:00:00
10   2007-11-12 00:00:00
11   2007-11-13 00:00:00
12   2007-11-14 00:00:00
13   2007-11-15 00:00:00
14   2007-11-16 00:00:00
...
985   2011-09-26 00:00:00
986   2011-09-27 00:00:00
987   2011-09-28 00:00:00
988   2011-09-29 00:00:00
989   2011-09-30 00:00:00
990   2011-10-03 00:00:00
991   2011-10-04 00:00:00
992   2011-10-05 00:00:00
993   2011-10-06 00:00:00
994   2011-10-07 00:00:00
995   2011-10-10 00:00:00
996   2011-10-11 00:00:00
997   2011-10-12 00:00:00
998   2011-10-13 00:00:00
999   2011-10-14 00:00:00
Name: date, Length: 1000

In [8]: pd.to_datetime(df.date)
Out[8]: 
0    1970-01-18 08:00:00
1    1970-01-19 08:00:00
2    1970-01-20 08:00:00
3    1970-01-21 08:00:00
4    1970-01-22 08:00:00
5    1970-01-14 16:00:00
6    1970-01-15 16:00:00
7    1970-01-16 16:00:00
8    1970-01-17 16:00:00
9    1970-01-18 16:00:00
10   1970-01-21 16:00:00
11   1970-01-22 16:00:00
12   1970-01-23 16:00:00
13   1970-01-14 00:00:00
14   1970-01-15 00:00:00
...
985   1970-01-24 08:00:00
986   1970-01-25 08:00:00
987   1970-01-26 08:00:00
988   1970-01-16 16:00:00
989   1970-01-17 16:00:00
990   1970-01-20 16:00:00
991   1970-01-21 16:00:00
992   1970-01-22 16:00:00
993   1970-01-23 16:00:00
994   1970-01-24 16:00:00
995   1970-01-17 00:00:00
996   1970-01-18 00:00:00
997   1970-01-19 00:00:00
998   1970-01-20 00:00:00
999   1970-01-21 00:00:00
Name: date, Length: 1000