用法:
DatetimeProperties.strftime(date_format, *args, **kwargs)
使用指定的
date_format
轉換為係列。返回由
date_format
指定的一係列格式化字符串,它支持與 python 標準庫相同的字符串格式。可以在 python string format doc 中找到字符串格式的詳細信息。- date_format:str
日期格式字符串(例如“%Y-%m-%d”)。
- Series
一係列格式化字符串。
參數:
返回:
注意:
尚不支持以下日期格式標識符:
%c
,%x
,``%X``例子:
>>> import cudf >>> import pandas as pd >>> weekday_series = cudf.Series(pd.date_range("2000-01-01", periods=3, ... freq="q")) >>> weekday_series.dt.strftime("%Y-%m-%d") >>> weekday_series 0 2000-03-31 1 2000-06-30 2 2000-09-30 dtype: datetime64[ns] 0 2000-03-31 1 2000-06-30 2 2000-09-30 dtype: object >>> weekday_series.dt.strftime("%Y %d %m") 0 2000 31 03 1 2000 30 06 2 2000 30 09 dtype: object >>> weekday_series.dt.strftime("%Y / %d / %m") 0 2000 / 31 / 03 1 2000 / 30 / 06 2 2000 / 30 / 09 dtype: object
相關用法
- Python cudf.core.series.DatetimeProperties.second用法及代碼示例
- Python cudf.core.series.DatetimeProperties.month用法及代碼示例
- Python cudf.core.series.DatetimeProperties.year用法及代碼示例
- Python cudf.core.series.DatetimeProperties.dayofweek用法及代碼示例
- Python cudf.core.series.DatetimeProperties.isocalendar用法及代碼示例
- Python cudf.core.series.DatetimeProperties.hour用法及代碼示例
- Python cudf.core.series.DatetimeProperties.ceil用法及代碼示例
- Python cudf.core.series.DatetimeProperties.floor用法及代碼示例
- Python cudf.core.series.DatetimeProperties.quarter用法及代碼示例
- Python cudf.core.series.DatetimeProperties.weekday用法及代碼示例
- Python cudf.core.series.DatetimeProperties.day用法及代碼示例
- Python cudf.core.series.DatetimeProperties.dayofyear用法及代碼示例
- Python cudf.core.series.DatetimeProperties.minute用法及代碼示例
- Python cudf.core.series.DatetimeProperties.day_of_year用法及代碼示例
- Python cudf.core.series.DatetimeProperties.round用法及代碼示例
- Python cudf.core.series.TimedeltaProperties.microseconds用法及代碼示例
- Python cudf.core.series.TimedeltaProperties.components用法及代碼示例
- Python cudf.core.series.TimedeltaProperties.days用法及代碼示例
- Python cudf.core.series.TimedeltaProperties.seconds用法及代碼示例
- Python cudf.core.series.TimedeltaProperties.nanoseconds用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.core.series.DatetimeProperties.strftime。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。