pandas.Period.weekofyear#

Period.weekofyear#

Get the week of the year on the given Period.

Weeks are numbered according to ISO 8601, where the first week of the year contains the first Thursday of the year.

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.dayofweek

Get the day component of the Period.

Period.weekday

Get the day component of the Period.

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-03-11", "h")
>>> p.weekofyear
10
>>> p = pd.Period("2018-02-01", "D")
>>> p.weekofyear
5
>>> p = pd.Period("2018-01-06", "D")
>>> p.weekofyear
1