Skip to main content
`Ctrl`+`K`

# pandas.Series.dt.day_of_year

Series.dt.day_of_year

  The ordinal day of the year.

  This attribute returns the day of the year for each datetime value in the Series/Index. Values range from 1 to 365 (or 366 for leap years).

  See also

  `DatetimeIndex.dayofweek`

    The day of the week with Monday=0, Sunday=6.

  `DatetimeIndex.day`

    The day of the datetime.

  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[us, UTC]
      >>> s.dt.day_of_year
      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.day_of_year
      Index([1, 32], dtype='int32')