pyspark.pandas.Series.dt.strftime¶
-
dt.
strftime
(date_format: str) → ps.Series¶ Convert to a string Series using specified date_format.
Return an series 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.
- Parameters
- date_formatstr
Date format string (example: “%%Y-%%m-%%d”).
- Returns
- Series
Series of formatted strings.
See also
Examples
>>> series = ps.Series(pd.date_range(pd.Timestamp("2018-03-10 09:00"), ... periods=3, freq='s')) >>> series 0 2018-03-10 09:00:00 1 2018-03-10 09:00:01 2 2018-03-10 09:00:02 dtype: datetime64[ns]
>>> series.dt.strftime('%B %d, %Y, %r') 0 March 10, 2018, 09:00:00 AM 1 March 10, 2018, 09:00:01 AM 2 March 10, 2018, 09:00:02 AM dtype: object