Skip to content

Commit c1c1c63

Browse files
author
Shashwat
committed
docs: infer_datetime_format() deprecated
1 parent d800024 commit c1c1c63

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

doc/source/user_guide/io.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,14 @@ parse_dates : boolean or list of ints or names or list of lists or dict, default
275275
infer_datetime_format : boolean, default ``False``
276276
If ``True`` and parse_dates is enabled for a column, attempt to infer the
277277
datetime format to speed up the processing.
278+
279+
.. deprecated:: 1.5.2
280+
``infer_datetime_format`` be deprecated (as a strict version of it will become the default);
281+
an easy workaround for non-strict parsing be clearly documented.
282+
283+
Currently, the only way to ensure consistent parsing is by explicitly passing
284+
``format=``. The argument ``infer_datetime_format``
285+
isn't strict, can be called together with ``format``, and can still break users' expectations:
278286
keep_date_col : boolean, default ``False``
279287
If ``True`` and parse_dates specifies combining multiple columns then keep the
280288
original columns.
@@ -916,12 +924,10 @@ an exception is raised, the next one is tried:
916924

917925
Note that performance-wise, you should try these methods of parsing dates in order:
918926

919-
1. Try to infer the format using ``infer_datetime_format=True`` (see section below).
920-
921-
2. If you know the format, use ``pd.to_datetime()``:
927+
1. If you know the format, use ``pd.to_datetime()``:
922928
``date_parser=lambda x: pd.to_datetime(x, format=...)``.
923929

924-
3. If you have a really non-standard format, use a custom ``date_parser`` function.
930+
2. If you have a really non-standard format, use a custom ``date_parser`` function.
925931
For optimal performance, this should be vectorized, i.e., it should accept arrays
926932
as arguments.
927933

0 commit comments

Comments
 (0)