From 83349703ceb8f9b8a67aae979f2ad5fd7e3e059e Mon Sep 17 00:00:00 2001 From: Natalia Mokeeva Date: Tue, 11 Jul 2023 12:26:59 +0200 Subject: [PATCH 1/2] DOC: to_datetime param format has no effect for df --- pandas/core/tools/datetimes.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index ea418a2c16d06..2ece60942cdf6 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -706,7 +706,8 @@ def to_datetime( arg : int, float, str, datetime, list, tuple, 1-d array, Series, DataFrame/dict-like The object to convert to a datetime. If a :class:`DataFrame` is provided, the method expects minimally the following columns: :const:`"year"`, - :const:`"month"`, :const:`"day"`. + :const:`"month"`, :const:`"day"`. The column "year" + must be specified in 4-digit format. errors : {'ignore', 'raise', 'coerce'}, default 'raise' - If :const:`'raise'`, then invalid parsing will raise an exception. - If :const:`'coerce'`, then invalid parsing will be set as :const:`NaT`. @@ -765,6 +766,11 @@ def to_datetime( time string (not necessarily in exactly the same format); - "mixed", to infer the format for each element individually. This is risky, and you should probably use it along with `dayfirst`. + + .. warning:: + + If a :class:`DataFrame` is passed, then `format` has no effect. + exact : bool, default True Control how `format` is used: From 19abef1c3df9d59ab05da601b331c085ec0621d6 Mon Sep 17 00:00:00 2001 From: Marco Edward Gorelli Date: Tue, 11 Jul 2023 13:01:22 +0100 Subject: [PATCH 2/2] warning -> note --- pandas/core/tools/datetimes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index 2ece60942cdf6..454c6e1be5b5f 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -767,7 +767,7 @@ def to_datetime( - "mixed", to infer the format for each element individually. This is risky, and you should probably use it along with `dayfirst`. - .. warning:: + .. note:: If a :class:`DataFrame` is passed, then `format` has no effect.