Skip to content

DOC: fix PR01,SA01 for pandas.Period.strftime #59673

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
merged 1 commit into from
Aug 31, 2024
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 @@ -73,7 +73,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
-i "pandas.NA SA01" \
-i "pandas.Period.freq GL08" \
-i "pandas.Period.ordinal GL08" \
-i "pandas.Period.strftime PR01,SA01" \
-i "pandas.Period.to_timestamp SA01" \
-i "pandas.PeriodDtype SA01" \
-i "pandas.PeriodDtype.freq SA01" \
Expand Down
21 changes: 21 additions & 0 deletions pandas/_libs/tslibs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2755,6 +2755,27 @@ cdef class _Period(PeriodMixin):
| ``%%`` | A literal ``'%'`` character. | |
+-----------+--------------------------------+-------+

The `strftime` method provides a way to represent a :class:`Period`
object as a string in a specified format. This is particularly useful
when displaying date and time data in different locales or customized
formats, suitable for reports or user interfaces. It extends the standard
Python string formatting capabilities with additional directives specific
to `pandas`, accommodating features like fiscal years and precise
sub-second components.

Parameters
----------
fmt : str or None
String containing the desired format directives. If ``None``, the
format is determined based on the Period's frequency.

See Also
--------
Timestamp.strftime : Return a formatted string of the Timestamp.
to_datetime : Convert argument to datetime.
time.strftime : Format a time object as a string according to a
specified format string in the standard Python library.

Notes
-----

Expand Down
Loading