pandas.Period.day_of_year#

Period.day_of_year#

Return the day of the year.

This attribute returns the day of the year on which the particular date occurs. The return value ranges between 1 to 365 for regular years and 1 to 366 for leap years.

The value comes from the last day of the first unit of the period’s frequency, so a "2M" period uses the last day of its first month.

Returns:
int

The day of year.

See also

Period.day

Return the day of the month.

Period.day_of_week

Return the day of week.

PeriodIndex.day_of_year

Return the day of year of all indexes.

Period.start_time

Get the Timestamp for the start of the period.

Period.end_time

Get the Timestamp for the end of the period.

Examples

>>> period = pd.Period("2015-10-23", freq='h')
>>> period.day_of_year
296
>>> period = pd.Period("2012-12-31", freq='D')
>>> period.day_of_year
366
>>> period = pd.Period("2013-01-01", freq='D')
>>> period.day_of_year
1