Skip to content

Commit

Permalink
DOC: add SA01 for pandas.tseries.api.guess_datetime_format (#58756)
Browse files Browse the repository at this point in the history
* DOC: add SA01 for pandas.tseries.api.guess_datetime_format

* DOC: remove SA01 for pandas.tseries.api.guess_datetime_format

* DOC: incorporate review suggestions

Co-authored-by: mroeschke <mroeschke@users.noreply.github.com>

---------

Co-authored-by: mroeschke <mroeschke@users.noreply.github.com>
  • Loading branch information
tuhinsharma121 and mroeschke committed May 17, 2024
1 parent 1a9a43d commit a3e751c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.testing.assert_index_equal PR07,SA01" \
-i "pandas.testing.assert_series_equal PR07,SA01" \
-i "pandas.timedelta_range SA01" \
-i "pandas.tseries.api.guess_datetime_format SA01" \
-i "pandas.tseries.offsets.BDay PR02,SA01" \
-i "pandas.tseries.offsets.BMonthBegin PR02" \
-i "pandas.tseries.offsets.BQuarterBegin PR02" \
Expand Down
10 changes: 10 additions & 0 deletions pandas/_libs/tslibs/parsing.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,10 @@ def guess_datetime_format(dt_str: str, bint dayfirst=False) -> str | None:
"""
Guess the datetime format of a given datetime string.

This function attempts to deduce the format of a given datetime string. It is
useful for situations where the datetime format is unknown and needs to be
determined for proper parsing. The function is not guaranteed to return a format.

Parameters
----------
dt_str : str
Expand All @@ -876,6 +880,12 @@ def guess_datetime_format(dt_str: str, bint dayfirst=False) -> str | None:
datetime format string (for `strftime` or `strptime`),
or None if it can't be guessed.

See Also
--------
to_datetime : Convert argument to datetime.
Timestamp : Pandas replacement for python datetime.datetime object.
DatetimeIndex : Immutable ndarray-like of datetime64 data.

Examples
--------
>>> from pandas.tseries.api import guess_datetime_format
Expand Down

0 comments on commit a3e751c

Please sign in to comment.