Skip to content

DOC: add SA01 for pandas.tseries.api.guess_datetime_format #58756

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,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