From d7677e474aca8f5dc812f0e4f26dab95ef5c4ecf Mon Sep 17 00:00:00 2001 From: Mircea Cosbuc Date: Sat, 10 Mar 2018 16:33:00 +0100 Subject: [PATCH] Add example to Series.dt.strftime --- pandas/core/indexes/datetimelike.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pandas/core/indexes/datetimelike.py b/pandas/core/indexes/datetimelike.py index e673bfe411cb4..5928c20714542 100644 --- a/pandas/core/indexes/datetimelike.py +++ b/pandas/core/indexes/datetimelike.py @@ -61,18 +61,26 @@ def strftime(self, date_format): return np.asarray(self.format(date_format=date_format), dtype=compat.text_type) strftime.__doc__ = """ - Return an array of formatted strings specified by date_format, which + Format series values with a date format string. + + This function formats series values as 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 <{0}>`__ + of the string format can be found in `python string format doc <{0}>`__. Parameters ---------- date_format : str - date format string (e.g. "%Y-%m-%d") + Date format string (e.g. "%Y-%m-%d"). Returns ------- ndarray of formatted strings + + Examples + -------- + >>> rng = pd.date_range('10/3/2018 16:20:10', periods=2, freq='H') + >>> rng.strftime("%Y-%m-%d") + array(['2018-10-03', '2018-10-03'], dtype='