pandas.Period.days_in_month#

Period.days_in_month#

Get the total number of days in the month that this period falls on.

This value depends on the month and whether the year is a leap year (e.g., February has 28 or 29 days).

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

See also

Period.daysinmonth

Gets the number of days in the month.

DatetimeIndex.daysinmonth

Gets the number of days in the month.

calendar.monthrange

Returns a tuple containing weekday (0-6 ~ Mon-Sun) and number of days (28-31).

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

>>> p = pd.Period('2018-2-17')
>>> p.days_in_month
28
>>> pd.Period('2018-03-01').days_in_month
31

Handles the leap year case as well:

>>> p = pd.Period('2016-2-17')
>>> p.days_in_month
29