From c1c1c63767e174dd4d1b8754b2d5e0e11705005c Mon Sep 17 00:00:00 2001 From: Shashwat Date: Tue, 20 Dec 2022 17:20:03 +0530 Subject: [PATCH 1/2] docs: infer_datetime_format() deprecated --- doc/source/user_guide/io.rst | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/doc/source/user_guide/io.rst b/doc/source/user_guide/io.rst index 3dcc52fb63eb7..b847adf56dbba 100644 --- a/doc/source/user_guide/io.rst +++ b/doc/source/user_guide/io.rst @@ -275,6 +275,14 @@ parse_dates : boolean or list of ints or names or list of lists or dict, default infer_datetime_format : boolean, default ``False`` If ``True`` and parse_dates is enabled for a column, attempt to infer the datetime format to speed up the processing. + + .. deprecated:: 1.5.2 + ``infer_datetime_format`` be deprecated (as a strict version of it will become the default); + an easy workaround for non-strict parsing be clearly documented. + + Currently, the only way to ensure consistent parsing is by explicitly passing + ``format=``. The argument ``infer_datetime_format`` + isn't strict, can be called together with ``format``, and can still break users' expectations: keep_date_col : boolean, default ``False`` If ``True`` and parse_dates specifies combining multiple columns then keep the original columns. @@ -916,12 +924,10 @@ an exception is raised, the next one is tried: Note that performance-wise, you should try these methods of parsing dates in order: -1. Try to infer the format using ``infer_datetime_format=True`` (see section below). - -2. If you know the format, use ``pd.to_datetime()``: +1. If you know the format, use ``pd.to_datetime()``: ``date_parser=lambda x: pd.to_datetime(x, format=...)``. -3. If you have a really non-standard format, use a custom ``date_parser`` function. +2. If you have a really non-standard format, use a custom ``date_parser`` function. For optimal performance, this should be vectorized, i.e., it should accept arrays as arguments. From 49c7b24ac0db724556c9f9ea0c431e02a7d971d5 Mon Sep 17 00:00:00 2001 From: Shashwat Date: Tue, 20 Dec 2022 22:21:09 +0530 Subject: [PATCH 2/2] docs: changes in deprecation msg --- doc/source/user_guide/io.rst | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/doc/source/user_guide/io.rst b/doc/source/user_guide/io.rst index b847adf56dbba..c74f9bb140e32 100644 --- a/doc/source/user_guide/io.rst +++ b/doc/source/user_guide/io.rst @@ -276,13 +276,8 @@ infer_datetime_format : boolean, default ``False`` If ``True`` and parse_dates is enabled for a column, attempt to infer the datetime format to speed up the processing. - .. deprecated:: 1.5.2 - ``infer_datetime_format`` be deprecated (as a strict version of it will become the default); - an easy workaround for non-strict parsing be clearly documented. - - Currently, the only way to ensure consistent parsing is by explicitly passing - ``format=``. The argument ``infer_datetime_format`` - isn't strict, can be called together with ``format``, and can still break users' expectations: + .. deprecated:: 2.0.0 + A strict version of this argument is now the default, passing it has no effect. keep_date_col : boolean, default ``False`` If ``True`` and parse_dates specifies combining multiple columns then keep the original columns.