當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python cudf.core.series.DatetimeProperties.isocalendar用法及代碼示例

用法:

DatetimeProperties.isocalendar()

返回一個 DataFrame,其中包含根據 ISO 8601 標準計算的年、周和日。

返回

DataFrame
帶有年、周和日列

例子

>>> ser = cudf.Series(pd.date_range(start="2021-07-25",
... end="2021-07-30"))
>>> ser.dt.isocalendar()
   year  week  day
0  2021    29    7
1  2021    30    1
2  2021    30    2
3  2021    30    3
4  2021    30    4
5  2021    30    5
>>> ser.dt.isocalendar().week
0    29
1    30
2    30
3    30
4    30
5    30
Name: week, dtype: object
>>> serIndex = cudf.to_datetime(pd.Series(["2010-01-01", pd.NaT]))
>>> serIndex.dt.isocalendar()
    year  week  day
0  2009    53     5
1  <NA>  <NA>  <NA>
>>> serIndex.dt.isocalendar().year
0    2009
1    <NA>
Name: year, dtype: object

相關用法


注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.core.series.DatetimeProperties.isocalendar。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。