Skip to content

Commit 2685aff

Browse files
author
Sylvain MARIE
committed
Fixed doctests
1 parent c093e86 commit 2685aff

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pandas/_libs/tslibs/period.pyx

+3-2
Original file line numberDiff line numberDiff line change
@@ -2395,17 +2395,18 @@ cdef class _Period(PeriodMixin):
23952395
def fast_strftime(self, fmt_str: str) -> str:
23962396
"""A faster alternative to `strftime` using string formatting.
23972397

2398-
`fmt_str` should be created using `convert_period_format(fmt)`.
2398+
`fmt_str` should be created using `convert_strftime_format(fmt)`.
23992399

24002400
See also `self.strftime`, that relies on `period_format`.
24012401

24022402
Examples
24032403
--------
24042404

2405+
>>> from pandas._libs.tslibs import convert_strftime_format
24052406
>>> a = Period(freq='Q-JUL', year=2006, quarter=1)
24062407
>>> a.strftime('%F-Q%q')
24072408
'2006-Q1'
2408-
>>> fast_fmt = convert_period_format('%F-Q%q')
2409+
>>> fast_fmt = convert_strftime_format('%F-Q%q', target="period")
24092410
>>> a.fast_strftime(fast_fmt)
24102411
'2006-Q1'
24112412
"""

pandas/_libs/tslibs/timestamps.pyx

+1
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,7 @@ class Timestamp(_Timestamp):
12041204

12051205
Examples
12061206
--------
1207+
>>> from pandas._libs.tslibs import convert_strftime_format
12071208
>>> ts = pd.Timestamp('2020-03-14T15:32:52.192548651')
12081209
>>> fmt = convert_strftime_format('%Y-%m-%d %X')
12091210
>>> ts.fast_strftime(fmt)

0 commit comments

Comments
 (0)