Period.base_period#

Period.base_period()[source]#

Return this period stripped of any offset and origin, keeping only its step and multiplier.

A “base period” is one whose intervals fall on the natural boundaries of its unit, with un-shifted ordinals - exactly what the unit factories such as of_days() and of_months() produce.

A period carrying an offset or an origin unwraps the period beneath it, so both are discarded.

To clear only one of the two, use without_offset() or without_ordinal_shift().

Return type:

Period

Returns:

A Period with the same step and multiplier as this one, but no date/time offset and no ordinal shift

Examples

>>> from datetime import datetime

An offset is discarded …

>>> water_day = Period.of_days(1).with_hour_offset(9)
>>> water_day.base_period()
P1D

… and so is an origin, together with any offset beneath it.

>>> water_day.with_origin(datetime(1883, 1, 1)).base_period()
P1D