pandas.PeriodIndex.strftime#
- PeriodIndex.strftime(date_format)[source]#
Convert to Index using specified date_format.
Return an Index of formatted strings specified by date_format, which supports the same string format as the python standard library. Details of the string format can be found in python string format doc.
Periodobjects additionally support several directives not covered there, detailed inPeriod.strftime().- Parameters:
- date_formatstr
Date format string (e.g. ā%Y-%m-%dā).
- Returns:
- Index
Index of formatted strings.
See also
to_datetimeConvert the given argument to datetime.
Period.strftimeFormat a single Period.
Examples
>>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M") >>> idx.strftime("%B %d, %Y") Index(['January 31, 2023', 'February 28, 2023', 'March 31, 2023'], dtype='str')