pyarrow.compute.week

pyarrow.compute.week(values, /, *, week_starts_monday=True, count_from_zero=False, first_week_is_fully_in_year=False, options=None, memory_pool=None)

Extract week of year number.

First week has the majority (4 or more) of its days in January. Year can have 52 or 53 weeks. Week numbering can start with 0 or 1 using DayOfWeekOptions.count_from_zero. An error is returned if the values have a defined timezone but it cannot be found in the timezone database.

Parameters:
valuesArray-like or scalar-like

Argument to compute function.

week_starts_mondaybool, default True

If True, weeks start on Monday; if False, on Sunday.

count_from_zerobool, default False

If True, dates at the start of a year that fall into the last week of the previous year emit 0. If False, they emit 52 or 53 (the week number of the last week of the previous year).

first_week_is_fully_in_yearbool, default False

If True, week number 0 is fully in January. If False, a week that begins on December 29, 30 or 31 is considered to be week number 0 of the following year.

optionspyarrow.compute.WeekOptions, optional

Alternative way of passing options.

memory_poolpyarrow.MemoryPool, optional

If not passed, will allocate memory from the default memory pool.