Skip to content

Commit cf82a45

Browse files
DOC: fix PR01,SA01 for pandas.Period.strftime (#59673)
1 parent 9b49486 commit cf82a45

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

ci/code_checks.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7373
-i "pandas.NA SA01" \
7474
-i "pandas.Period.freq GL08" \
7575
-i "pandas.Period.ordinal GL08" \
76-
-i "pandas.Period.strftime PR01,SA01" \
7776
-i "pandas.Period.to_timestamp SA01" \
7877
-i "pandas.PeriodDtype SA01" \
7978
-i "pandas.PeriodDtype.freq SA01" \

pandas/_libs/tslibs/period.pyx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2755,6 +2755,27 @@ cdef class _Period(PeriodMixin):
27552755
| ``%%`` | A literal ``'%'`` character. | |
27562756
+-----------+--------------------------------+-------+
27572757

2758+
The `strftime` method provides a way to represent a :class:`Period`
2759+
object as a string in a specified format. This is particularly useful
2760+
when displaying date and time data in different locales or customized
2761+
formats, suitable for reports or user interfaces. It extends the standard
2762+
Python string formatting capabilities with additional directives specific
2763+
to `pandas`, accommodating features like fiscal years and precise
2764+
sub-second components.
2765+
2766+
Parameters
2767+
----------
2768+
fmt : str or None
2769+
String containing the desired format directives. If ``None``, the
2770+
format is determined based on the Period's frequency.
2771+
2772+
See Also
2773+
--------
2774+
Timestamp.strftime : Return a formatted string of the Timestamp.
2775+
to_datetime : Convert argument to datetime.
2776+
time.strftime : Format a time object as a string according to a
2777+
specified format string in the standard Python library.
2778+
27582779
Notes
27592780
-----
27602781

0 commit comments

Comments
 (0)