Features¶
This is a high level overview of the features provided by the iso-week-date package.
IsoWeek and IsoWeekDate classes¶
The IsoWeek and IsoWeekDate classes both provide the following functionalities:
- Parsing from string, date and datetime objects
- Conversion to string, date and datetime objects
- Comparison operations between
IsoWeek(respIsoWeekDate) objects - Addition with
intandIterable[int]types - Subtraction with
int,IsoWeek(respIsoWeekDate), andIterable[int | IsoWeek]types - Range between two
IsoWeek(resp.IsoWeekDate) objects __next__method to generate the nextIsoWeek(resp.IsoWeekDate) object
IsoWeek unique methods/features:
daysproperties that lists the dates in the given weeknthmethod to get the nth day of the week as dateinoperator andcontainsmethod to check if a (iterable of) week(s), string(s) and/or date(s) is contained in the given weekweeksoutmethod to generate a list of weeks that are n_weeks after the given week- Addition and subtraction with
intdefaults to adding/subtracting weeks
IsoWeekDate unique methods/features:
dayproperty that returns the weekday as integerisoweekproperty that returns the ISO Week of the given date (as string)daysoutmethod to generate a list of dates that are n_days after the given date- Addition and subtraction with
intdefaults to adding/subtracting days
pandas and polars utils¶
pandas_utils and polars_utils modules provide functionalities to work with and move back and forth with series of ISO Week date formats.
In specific both modules implements the following functionalities:
datetime_to_isoweekanddatetime_to_isoweekdateto convert a series of datetime objects to a series of ISO Week (date) stringsisoweek_to_datetimeandisoweekdate_to_datetimeto convert a series of ISO Week (date) strings to a series of datetime objectsis_isoweek_seriesandis_isoweekdate_seriesto check if a string series values match the ISO Week (date) format
Custom offset¶
One of the main reason for this library to exist is the need and the flexibility to work with custom offsets, i.e. to be able to add/subtract a custom offset (as timedelta) to the default ISO Week start and given date, and get a "shifted" week.
This feature is available both in the IsoWeek and IsoWeekDate classes and the dataframe functionalities.
To check an example see the working with custom offset section.