File tree 1 file changed +33
-0
lines changed
1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,39 @@ Optional libraries below the lowest tested version may still work, but are not c
112
112
113
113
See :ref: `install.dependencies ` and :ref: `install.optional_dependencies ` for more.
114
114
115
+ Datetimes are now parsed with a consistent format
116
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117
+
118
+ :func: `to_datetime ` now parses dates with a consistent format, which is guessed from the first non-NA value
119
+ (unless ``format `` is specified). Previously, it would've guessed the format for each element individually.
120
+
121
+ *Old behavior *:
122
+
123
+ .. code-block :: ipython
124
+
125
+ In [1]: ser = pd.Series(['13-01-2000', '12-01-2000'])
126
+ In [2]: pd.to_datetime(ser)
127
+ Out[2]:
128
+ 0 2000-01-13
129
+ 1 2000-12-01
130
+ dtype: datetime64[ns]
131
+
132
+ *New behavior *:
133
+
134
+ .. ipython :: python
135
+ :okwarning:
136
+
137
+ ser = pd.Series([' 13-01-2000' , ' 12-01-2000' ])
138
+ pd.to_datetime(ser)
139
+
140
+ Note that this affects :func: `read_csv ` as well.
141
+
142
+ If you still need to parse dates with inconsistent formats, you'll need to apply :func: `to_datetime `
143
+ to each element individually, e.g. ::
144
+
145
+ ser = pd.Series(['13-01-2000', '12 January 2000'])
146
+ ser.apply(pd.to_datetime)
147
+
115
148
.. _whatsnew_160.api_breaking.other :
116
149
117
150
Other API changes
You can’t perform that action at this time.
0 commit comments