pandas.DatetimeIndex.dayofyear#
- propertyDatetimeIndex.dayofyear[source] #
The ordinal day of the year.
Examples
For Series:
>>> s = pd.Series(["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"]) >>> s = pd.to_datetime(s) >>> s 0 2020年01月01日 10:00:00+00:00 1 2020年02月01日 11:00:00+00:00 dtype: datetime64[ns, UTC] >>> s.dt.dayofyear 0 1 1 32 dtype: int32
For DatetimeIndex:
>>> idx = pd.DatetimeIndex(["1/1/2020 10:00:00+00:00", ... "2/1/2020 11:00:00+00:00"]) >>> idx.dayofyear Index([1, 32], dtype='int32')