pandas.Series.dt.isocalendar#
- Series.dt.isocalendar()[源代码]#
根据 ISO 8601 标准计算年、周和日。
- Returns:
- DataFrame
带有 year, week 和 day 列。
参见
Timestamp.isocalendar该函数返回一个包含给定 Timestamp 对象的 ISO 年、周数和工作日的 3 元组。
datetime.date.isocalendar返回一个包含三个组件的命名元组对象:year、week 和 weekday。
Examples
>>> ser = pd.to_datetime(pd.Series(["2010-01-01", pd.NaT])) >>> ser.dt.isocalendar() year week day 0 2009 53 5 1 <NA> <NA> <NA> >>> ser.dt.isocalendar().week 0 53 1 <NA> Name: week, dtype: UInt32