Skip to content

Polars utils module

Functions

iso_week_date.polars_utils.datetime_to_isoweek

datetime_to_isoweek(series: ExprOrSeries, offset: OffsetType = timedelta(days=0)) -> ExprOrSeries

Converts date(time) series/expr to str values representing ISO Week format YYYY-WNN.

Parameters:

Name Type Description Default
series ExprOrSeries

series or expr of date or datetime values

required
offset OffsetType

offset in days or timedelta. It represents how many days to add to the date before converting to ISO Week, it can be negative

timedelta(days=0)

Returns:

Type Description
ExprOrSeries

Series or Expr with converted ISO Week values (in format YYYY-WNN)

Raises:

Type Description
TypeError

If any of the following condition is met:

  • series is not of type pl.Series or pl.Expr
  • offset is not of type timedelta or int

Examples:

>>> from datetime import date, timedelta
>>> import polars as pl
>>> from iso_week_date.polars_utils import datetime_to_isoweek
>>>
>>> s = pl.date_range(date(2023, 1, 1), date(2023, 1, 5), interval="1d", eager=True)
>>> datetime_to_isoweek(s, offset=timedelta(days=1))
shape: (5,)
Series: 'literal' [str]
[
   "2022-W52"
   "2022-W52"
   "2023-W01"
   "2023-W01"
   "2023-W01"
]
>>> df = pl.DataFrame({"date": s})
>>> df.select(datetime_to_isoweek(pl.col("date"), offset=1))
shape: (5, 1)
┌──────────┐
│ date     │
│ ---      │
│ str      │
╞══════════╡
│ 2022-W52 │
│ 2022-W52 │
│ 2023-W01 │
│ 2023-W01 │
│ 2023-W01 │
└──────────┘
Source code in src/iso_week_date/polars_utils.py
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
def datetime_to_isoweek(series: ExprOrSeries, offset: OffsetType = timedelta(days=0)) -> ExprOrSeries:
    """Converts `date(time)` `series/expr` to `str` values representing ISO Week format YYYY-WNN.

    Arguments:
        series: series or expr of `date` or `datetime` values
        offset: offset in days or `timedelta`. It represents how many days to add to the date before converting to ISO
            Week, it can be negative

    Returns:
        Series or Expr with converted ISO Week values (in format YYYY-WNN)

    Raises:
        TypeError: If any of the following condition is met:

            * `series` is not of type `pl.Series` or `pl.Expr`
            * `offset` is not of type `timedelta` or `int`

    Examples:
        >>> from datetime import date, timedelta
        >>> import polars as pl
        >>> from iso_week_date.polars_utils import datetime_to_isoweek
        >>>
        >>> s = pl.date_range(date(2023, 1, 1), date(2023, 1, 5), interval="1d", eager=True)
        >>> datetime_to_isoweek(s, offset=timedelta(days=1))  # doctest: +NORMALIZE_WHITESPACE
        shape: (5,)
        Series: 'literal' [str]
        [
           "2022-W52"
           "2022-W52"
           "2023-W01"
           "2023-W01"
           "2023-W01"
        ]
        >>> df = pl.DataFrame({"date": s})
        >>> df.select(datetime_to_isoweek(pl.col("date"), offset=1))
        shape: (5, 1)
        ┌──────────┐
        │ date     │
        │ ---      │
        │ str      │
        ╞══════════╡
        │ 2022-W52 │
        │ 2022-W52 │
        │ 2023-W01 │
        │ 2023-W01 │
        │ 2023-W01 │
        └──────────┘
    """
    return _datetime_to_format(series, offset, ISOWEEK__DATE_FORMAT)

iso_week_date.polars_utils.datetime_to_isoweekdate

datetime_to_isoweekdate(series: ExprOrSeries, offset: OffsetType = timedelta(days=0)) -> ExprOrSeries

Converts date(time) series/expr to str values representing ISO Week date format YYYY-WNN-D.

Parameters:

Name Type Description Default
series ExprOrSeries

series or expr of date or datetime values

required
offset OffsetType

offset in days or timedelta. It represents how many days to add to the date before converting to ISO Week, it can be negative

timedelta(days=0)

Returns:

Type Description
ExprOrSeries

Series or Expr with converted ISO Week values (in format YYYY-WNN-D)

Raises:

Type Description
TypeError

If any of the following condition is met:

  • series is not of type pl.Series or pl.Expr
  • offset is not of type timedelta or int

Examples:

>>> from datetime import date, timedelta
>>> import polars as pl
>>> from iso_week_date.polars_utils import datetime_to_isoweekdate
>>>
>>> s = pl.date_range(date(2023, 1, 1), date(2023, 1, 5), interval="1d", eager=True)
>>> datetime_to_isoweekdate(s, offset=timedelta(days=1))
shape: (5,)
Series: 'literal' [str]
[
   "2022-W52-6"
   "2022-W52-7"
   "2023-W01-1"
   "2023-W01-2"
   "2023-W01-3"
]
>>> df = pl.DataFrame({"date": s})
>>> df.select(datetime_to_isoweekdate(pl.col("date"), offset=1))
shape: (5, 1)
┌────────────┐
│ date       │
│ ---        │
│ str        │
╞════════════╡
│ 2022-W52-6 │
│ 2022-W52-7 │
│ 2023-W01-1 │
│ 2023-W01-2 │
│ 2023-W01-3 │
└────────────┘
Source code in src/iso_week_date/polars_utils.py
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
def datetime_to_isoweekdate(series: ExprOrSeries, offset: OffsetType = timedelta(days=0)) -> ExprOrSeries:
    """Converts `date(time)` `series/expr`  to `str` values representing ISO Week date format YYYY-WNN-D.

    Arguments:
        series: series or expr of `date` or `datetime` values
        offset: offset in days or `timedelta`. It represents how many days to add to the date before converting to ISO
            Week, it can be negative

    Returns:
        Series or Expr with converted ISO Week values (in format YYYY-WNN-D)

    Raises:
        TypeError: If any of the following condition is met:

            * `series` is not of type `pl.Series` or `pl.Expr`
            * `offset` is not of type `timedelta` or `int`

    Examples:
        >>> from datetime import date, timedelta
        >>> import polars as pl
        >>> from iso_week_date.polars_utils import datetime_to_isoweekdate
        >>>
        >>> s = pl.date_range(date(2023, 1, 1), date(2023, 1, 5), interval="1d", eager=True)
        >>> datetime_to_isoweekdate(s, offset=timedelta(days=1))  # doctest: +NORMALIZE_WHITESPACE
        shape: (5,)
        Series: 'literal' [str]
        [
           "2022-W52-6"
           "2022-W52-7"
           "2023-W01-1"
           "2023-W01-2"
           "2023-W01-3"
        ]
        >>> df = pl.DataFrame({"date": s})
        >>> df.select(datetime_to_isoweekdate(pl.col("date"), offset=1))
        shape: (5, 1)
        ┌────────────┐
        │ date       │
        │ ---        │
        │ str        │
        ╞════════════╡
        │ 2022-W52-6 │
        │ 2022-W52-7 │
        │ 2023-W01-1 │
        │ 2023-W01-2 │
        │ 2023-W01-3 │
        └────────────┘
    """
    return _datetime_to_format(series, offset, ISOWEEKDATE__DATE_FORMAT)

iso_week_date.polars_utils.isoweek_to_datetime

isoweek_to_datetime(series: ExprOrSeries, offset: OffsetType = timedelta(days=0), weekday: int = 1, *, strict: bool = True) -> ExprOrSeries

Converts series or expr of str values in ISO Week format YYYY-WNN to a series or expr of pl.Date values.

offset represents how many days to add to the date before converting to pl.Date, and it can be negative.

weekday represents the weekday to use for conversion in ISO Week format (1-7), where 1 is the first day of the week, 7 is the last one.

Parameters:

Name Type Description Default
series ExprOrSeries

Series or Expr of str values in ISO Week format.

required
offset OffsetType

Offset in days or timedelta. It represents how many days to add to the date before converting to IsoWeek, it can be negative.

timedelta(days=0)
weekday int

Weekday to use for conversion (1-7)

1
strict bool

Raise an error if the values cannot be converted to datetime. Otherwise mask out with a null value.

True

Returns:

Type Description
ExprOrSeries

Series or Expr of converted date values

Raises:

Type Description
TypeError

If any of the following condition is met:

  • series is not of type pl.Series or pl.Expr
  • offset is not of type timedelta or int
  • weekday is not of type int (bool is not accepted)
ValueError

If weekday is not an integer between 1 and 7

Examples:

>>> from datetime import timedelta
>>> import polars as pl
>>> from iso_week_date.polars_utils import isoweek_to_datetime
>>>
>>> s = pl.Series(["2022-W52", "2023-W01", "2023-W02"])
>>> isoweek_to_datetime(series=s, offset=timedelta(days=1))
shape: (3,)
Series: '' [date]
[
    2022-12-27
    2023-01-03
    2023-01-10
]
Source code in src/iso_week_date/polars_utils.py
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
def isoweek_to_datetime(
    series: ExprOrSeries,
    offset: OffsetType = timedelta(days=0),
    weekday: int = 1,
    *,
    strict: bool = True,
) -> ExprOrSeries:
    """Converts series or expr of `str` values in ISO Week format YYYY-WNN to a series or expr of `pl.Date` values.

    `offset` represents how many days to add to the date before converting to `pl.Date`, and it can be negative.

    `weekday` represents the weekday to use for conversion in ISO Week format (1-7), where 1 is the first day of the
    week, 7 is the last one.

    Arguments:
        series: Series or Expr of `str` values in ISO Week format.
        offset: Offset in days or `timedelta`. It represents how many days to add to the date before converting to
            IsoWeek, it can be negative.
        weekday: Weekday to use for conversion (1-7)
        strict: Raise an error if the values cannot be converted to datetime. Otherwise mask out with a null value.

    Returns:
        Series or Expr of converted date values

    Raises:
        TypeError: If any of the following condition is met:

            * `series` is not of type `pl.Series` or `pl.Expr`
            * `offset` is not of type `timedelta` or `int`
            * `weekday` is not of type `int` (`bool` is not accepted)
        ValueError: If `weekday` is not an integer between 1 and 7

    Examples:
        >>> from datetime import timedelta
        >>> import polars as pl
        >>> from iso_week_date.polars_utils import isoweek_to_datetime
        >>>
        >>> s = pl.Series(["2022-W52", "2023-W01", "2023-W02"])
        >>> isoweek_to_datetime(series=s, offset=timedelta(days=1))  # doctest: +NORMALIZE_WHITESPACE
        shape: (3,)
        Series: '' [date]
        [
            2022-12-27
            2023-01-03
            2023-01-10
        ]
    """
    if not isinstance(offset, (timedelta, int)):
        msg = f"`offset` must be of type `timedelta` or `int`, found {type(offset)}"
        raise TypeError(msg)

    # `bool` is excluded explicitly: `isinstance(True, int)` and `True in range(1, 8)` both hold, so
    # a bare range check would interpolate the literal string "True" into the value being parsed.
    if not isinstance(weekday, int) or isinstance(weekday, bool):
        msg = f"`weekday` must be an integer between 1 and 7, found {type(weekday)}"
        raise TypeError(msg)

    if weekday not in range(1, 8):
        msg = f"`weekday` value must be an integer between 1 and 7, found {weekday}"
        raise ValueError(msg)

    _offset = timedelta(days=offset) if isinstance(offset, int) else offset

    return (series + f"-{weekday}").str.strptime(pl.Date, ISOWEEKDATE__DATE_FORMAT, strict=strict) + _offset

iso_week_date.polars_utils.isoweekdate_to_datetime

isoweekdate_to_datetime(series: ExprOrSeries, offset: OffsetType = timedelta(days=0), *, strict: bool = True) -> ExprOrSeries

Converts series/expr of values in ISO Week date format YYYY-WNN-D to a series or expr of pl.Date values.

offset represents how many days to add to the date before converting to pl.Date, and it can be negative.

Parameters:

Name Type Description Default
series ExprOrSeries

Series or Expr of str values in ISO Week date format

required
offset OffsetType

Offset in days or timedelta. It represents how many days to add to the date before converting to IsoWeek, it can be negative

timedelta(days=0)
strict bool

Raise an error if the values cannot be converted to datetime. Otherwise mask out with a null value.

True

Returns:

Type Description
ExprOrSeries

Series or Expr of converted date values

Raises:

Type Description
TypeError

If any of the following condition is met:

  • series is not of type pl.Series or pl.Expr
  • offset is not of type timedelta or int

Examples:

>>> from datetime import timedelta
>>> import polars as pl
>>> from iso_week_date.polars_utils import isoweekdate_to_datetime
>>>
>>> s = pl.Series(["2022-W52-7", "2023-W01-1", "2023-W02-1"])
>>> isoweekdate_to_datetime(series=s, offset=timedelta(days=1))
shape: (3,)
Series: '' [date]
[
    2023-01-02
    2023-01-03
    2023-01-10
]
Source code in src/iso_week_date/polars_utils.py
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
def isoweekdate_to_datetime(
    series: ExprOrSeries,
    offset: OffsetType = timedelta(days=0),
    *,
    strict: bool = True,
) -> ExprOrSeries:
    """Converts `series/expr` of values in ISO Week date format YYYY-WNN-D to a series or expr of `pl.Date` values.

    `offset` represents how many days to add to the date before converting to `pl.Date`, and it can be negative.

    Arguments:
        series: Series or Expr of `str` values in ISO Week date format
        offset: Offset in days or `timedelta`. It represents how many days to add to the date before converting to
            IsoWeek, it can be negative
        strict: Raise an error if the values cannot be converted to datetime. Otherwise mask out with a null value.

    Returns:
        Series or Expr of converted date values

    Raises:
        TypeError: If any of the following condition is met:

            * `series` is not of type `pl.Series` or `pl.Expr`
            * `offset` is not of type `timedelta` or `int`

    Examples:
        >>> from datetime import timedelta
        >>> import polars as pl
        >>> from iso_week_date.polars_utils import isoweekdate_to_datetime
        >>>
        >>> s = pl.Series(["2022-W52-7", "2023-W01-1", "2023-W02-1"])
        >>> isoweekdate_to_datetime(series=s, offset=timedelta(days=1))  # doctest: +NORMALIZE_WHITESPACE
        shape: (3,)
        Series: '' [date]
        [
            2023-01-02
            2023-01-03
            2023-01-10
        ]
    """
    if not isinstance(offset, (timedelta, int)):
        msg = f"`offset` must be of type `timedelta` or `int`, found {type(offset)}"
        raise TypeError(msg)

    _offset = timedelta(days=offset) if isinstance(offset, int) else offset

    return series.str.strptime(pl.Date, ISOWEEKDATE__DATE_FORMAT, strict=strict) + _offset

iso_week_date.polars_utils.is_isoweek_series

is_isoweek_series(series: Series) -> bool
is_isoweek_series(series: Expr) -> pl.Expr
is_isoweek_series(series: Series | Expr) -> bool | pl.Expr

Checks if a series or expr contains only values in ISO Week format.

Parameters:

Name Type Description Default
series Series | Expr

series or expr of str values to check against "YYYY-WNN" pattern

required

Returns:

Type Description
bool | Expr

For a pl.Series, True if all values match ISO Week format and False otherwise. For a pl.Expr, a boolean Expr computing the same answer, to be used inside select / filter. An Expr is not a bool, so if is_isoweek_series(expr): raises on its ambiguous truth value.

Raises:

Type Description
TypeError

If series is not of type pl.Series or pl.Expr

Examples:

>>> import polars as pl
>>> from iso_week_date.polars_utils import is_isoweek_series
>>>
>>> s = pl.Series(["2022-W52", "2023-W01", "2023-W02"])
>>> is_isoweek_series(s)
True

The Expr form answers inside a frame:

>>> df = pl.DataFrame({"isoweek": ["2022-W52", "2023-W01"]})
>>> df.select(is_isoweek=is_isoweek_series(pl.col("isoweek")))["is_isoweek"].item()
True
Source code in src/iso_week_date/polars_utils.py
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
def is_isoweek_series(series: pl.Series | pl.Expr) -> bool | pl.Expr:
    """Checks if a series or expr contains only values in ISO Week format.

    Arguments:
        series: series or expr of `str` values to check against "YYYY-WNN" pattern

    Returns:
        For a `pl.Series`, `True` if all values match ISO Week format and `False` otherwise. For a
            `pl.Expr`, a boolean `Expr` computing the same answer, to be used inside `select` /
            `filter`. An `Expr` is not a `bool`, so `if is_isoweek_series(expr):` raises on its
            ambiguous truth value.

    Raises:
        TypeError: If `series` is not of type `pl.Series` or `pl.Expr`

    Examples:
        >>> import polars as pl
        >>> from iso_week_date.polars_utils import is_isoweek_series
        >>>
        >>> s = pl.Series(["2022-W52", "2023-W01", "2023-W02"])
        >>> is_isoweek_series(s)
        True

        The `Expr` form answers inside a frame:

        >>> df = pl.DataFrame({"isoweek": ["2022-W52", "2023-W01"]})
        >>> df.select(is_isoweek=is_isoweek_series(pl.col("isoweek")))["is_isoweek"].item()
        True
    """
    return _match_series(series, ISOWEEK_PATTERN.pattern)

iso_week_date.polars_utils.is_isoweekdate_series

is_isoweekdate_series(series: Series) -> bool
is_isoweekdate_series(series: Expr) -> pl.Expr
is_isoweekdate_series(series: Series | Expr) -> bool | pl.Expr

Checks if a series or expr contains only values in ISO Week date format.

Parameters:

Name Type Description Default
series Series | Expr

series or expr of str values to check against "YYYY-WNN-D" pattern

required

Returns:

Type Description
bool | Expr

For a pl.Series, True if all values match ISO Week date format and False otherwise. For a pl.Expr, a boolean Expr computing the same answer, to be used inside select / filter. An Expr is not a bool, so if is_isoweekdate_series(expr): raises on its ambiguous truth value.

Raises:

Type Description
TypeError

If series is not of type pl.Series or pl.Expr

Examples:

>>> import polars as pl
>>> from iso_week_date.polars_utils import is_isoweekdate_series
>>>
>>> s = pl.Series(["2022-W52-1", "2023-W01-1", "2023-W02-1"])
>>> is_isoweekdate_series(series=s)
True

The Expr form answers inside a frame:

>>> df = pl.DataFrame({"isoweekdate": ["2022-W52-1", "2023-W01-1"]})
>>> df.select(check=is_isoweekdate_series(pl.col("isoweekdate")))["check"].item()
True
Source code in src/iso_week_date/polars_utils.py
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
def is_isoweekdate_series(series: pl.Series | pl.Expr) -> bool | pl.Expr:
    """Checks if a series or expr contains only values in ISO Week date format.

    Arguments:
        series: series or expr of `str` values to check against "YYYY-WNN-D" pattern

    Returns:
        For a `pl.Series`, `True` if all values match ISO Week date format and `False` otherwise. For
            a `pl.Expr`, a boolean `Expr` computing the same answer, to be used inside `select` /
            `filter`. An `Expr` is not a `bool`, so `if is_isoweekdate_series(expr):` raises on its
            ambiguous truth value.

    Raises:
        TypeError: If `series` is not of type `pl.Series` or `pl.Expr`

    Examples:
        >>> import polars as pl
        >>> from iso_week_date.polars_utils import is_isoweekdate_series
        >>>
        >>> s = pl.Series(["2022-W52-1", "2023-W01-1", "2023-W02-1"])
        >>> is_isoweekdate_series(series=s)
        True

        The `Expr` form answers inside a frame:

        >>> df = pl.DataFrame({"isoweekdate": ["2022-W52-1", "2023-W01-1"]})
        >>> df.select(check=is_isoweekdate_series(pl.col("isoweekdate")))["check"].item()
        True
    """
    return _match_series(series, ISOWEEKDATE_PATTERN.pattern)

Series extension

iso_week_date.polars_utils.SeriesIsoWeek

Bases: Generic[ExprOrSeries]

Polars Series and Expr extension that provides methods for working with ISO weeks and dates.

Instead of importing and working with single functions from the polars_utils module, it is possible to import the Series and Expr extension class to be able to use the functions as methods on Series and Expr objects.

To accomplish this, it is enough to load SeriesIsoWeek into scope:

from datetime import date, timedelta
import polars as pl
from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401

s = pl.date_range(date(2023, 1, 1), date(2023, 1, 10), interval="1d")
s.iwd.datetime_to_isoweek(offset=timedelta(days=1))

df = pl.DataFrame({"date": s})
df.select(pl.col("date").iwd.datetime_to_isoweek(offset=1))

Parameters:

Name Type Description Default
series ExprOrSeries

ExprOrSerieshe pandas Series object the extension is attached to.

required

Attributes:

Name Type Description
_series ExprOrSeries

ExprOrSerieshe pandas Series object the extension is attached to.

Source code in src/iso_week_date/polars_utils.py
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
@pl.api.register_series_namespace("iwd")
@pl.api.register_expr_namespace("iwd")
class SeriesIsoWeek(Generic[ExprOrSeries]):
    """Polars Series and Expr extension that provides methods for working with ISO weeks and dates.

    Instead of importing and working with single functions from the `polars_utils` module, it is possible to import the
    Series and Expr [extension class](https://pola-rs.github.io/polars/py-polars/html/reference/api.html) to be able to
    use the functions as methods on Series and Expr objects.

    To accomplish this, it is enough to load `SeriesIsoWeek` into scope:

    ```python hl_lines="3 6 9"
    from datetime import date, timedelta
    import polars as pl
    from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401

    s = pl.date_range(date(2023, 1, 1), date(2023, 1, 10), interval="1d")
    s.iwd.datetime_to_isoweek(offset=timedelta(days=1))

    df = pl.DataFrame({"date": s})
    df.select(pl.col("date").iwd.datetime_to_isoweek(offset=1))
    ```

    Arguments:
        series: ExprOrSerieshe pandas Series object the extension is attached to.

    Attributes:
        _series: ExprOrSerieshe pandas Series object the extension is attached to.
    """

    def __init__(self: Self, series: ExprOrSeries) -> None:
        self._series: ExprOrSeries = series

    def datetime_to_isoweek(self: Self, offset: OffsetType = timedelta(0)) -> ExprOrSeries:
        """Converts `date(time)` `series/expr` to `str` values representing ISO Week format YYYY-WNN.

        Arguments:
            offset: offset in days or `timedelta`. It represents how many days to add to the date before converting to
                ISO Week, it can be negative

        Returns:
            Series or Expr with converted ISO Week values (in format YYYY-WNN)

        Raises:
            TypeError: If `offset` is not of type `timedelta` or `int`

        Examples:
            >>> from datetime import date, timedelta
            >>> import polars as pl
            >>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
            >>>
            >>> s = pl.date_range(date(2023, 1, 1), date(2023, 1, 5), interval="1d", eager=True)
            >>> s.iwd.datetime_to_isoweek(offset=timedelta(days=1))  # doctest: +NORMALIZE_WHITESPACE
            shape: (5,)
            Series: 'literal' [str]
            [
                "2022-W52"
                "2022-W52"
                "2023-W01"
                "2023-W01"
                "2023-W01"
            ]
            >>> df = pl.DataFrame({"date": s})
            >>> df.select(pl.col("date").iwd.datetime_to_isoweek(offset=1))
            shape: (5, 1)
            ┌──────────┐
            │ date     │
            │ ---      │
            │ str      │
            ╞══════════╡
            │ 2022-W52 │
            │ 2022-W52 │
            │ 2023-W01 │
            │ 2023-W01 │
            │ 2023-W01 │
            └──────────┘
        """
        return datetime_to_isoweek(self._series, offset=offset)

    def datetime_to_isoweekdate(self: Self, offset: OffsetType = timedelta(0)) -> ExprOrSeries:
        """Converts `date(time)` `series/expr` to `str` values representing ISO Week date format YYYY-WNN-D.

        Arguments:
            offset: offset in days or `timedelta`. It represents how many days to add to the date before converting to
                ISO Week, it can be negative

        Returns:
            Series or Expr with converted ISO Week values (in format YYYY-WNN-D)

        Raises:
            TypeError: If `offset` is not of type `timedelta` or `int`

        Examples:
            >>> from datetime import date, timedelta
            >>> import polars as pl
            >>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
            >>>
            >>> s = pl.date_range(date(2023, 1, 1), date(2023, 1, 5), interval="1d", eager=True)
            >>> s.iwd.datetime_to_isoweekdate(offset=timedelta(days=1))  # doctest: +NORMALIZE_WHITESPACE
            shape: (5,)
            Series: 'literal' [str]
            [
                "2022-W52-6"
                "2022-W52-7"
                "2023-W01-1"
                "2023-W01-2"
                "2023-W01-3"
            ]
            >>> df = pl.DataFrame({"date": s})
            >>> df.select(pl.col("date").iwd.datetime_to_isoweekdate(offset=1))
            shape: (5, 1)
            ┌────────────┐
            │ date       │
            │ ---        │
            │ str        │
            ╞════════════╡
            │ 2022-W52-6 │
            │ 2022-W52-7 │
            │ 2023-W01-1 │
            │ 2023-W01-2 │
            │ 2023-W01-3 │
            └────────────┘
        """
        return datetime_to_isoweekdate(self._series, offset=offset)

    def isoweek_to_datetime(
        self: Self,
        offset: OffsetType = timedelta(0),
        weekday: int = 1,
        *,
        strict: bool = True,
    ) -> ExprOrSeries:
        """Converts series or expr of `str` values in ISO Week format YYYY-WNN to a series or expr of `pl.Date` values.

        `offset` represents how many days to add to the date before converting to `pl.Date`, and it can be negative.

        `weekday` represents the weekday to use for conversion in ISO Week format (1-7), where 1 is the first day of the
        week, 7 is the last one.

        Arguments:
            offset: Offset in days or `timedelta`. It represents how many days to add to the date before converting to
                IsoWeek, it can be negative.
            weekday: Weekday to use for conversion (1-7).
            strict: Raise an error if the values cannot be converted to datetime. Otherwise mask out with a null value.

        Returns:
            Series or Expr of converted date values

        Raises:
            TypeError: If `offset` is not of type `timedelta` or `int`
            ValueError: If `weekday` is not an integer between 1 and 7

        Examples:
            >>> from datetime import timedelta
            >>> import polars as pl
            >>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
            >>>
            >>> s = pl.Series(["2022-W52", "2023-W01", "2023-W02"])
            >>> s.iwd.isoweek_to_datetime(offset=timedelta(days=1))  # doctest: +NORMALIZE_WHITESPACE
            shape: (3,)
            Series: '' [date]
            [
                2022-12-27
                2023-01-03
                2023-01-10
            ]
        """
        return isoweek_to_datetime(self._series, offset=offset, weekday=weekday, strict=strict)

    def isoweekdate_to_datetime(self: Self, offset: OffsetType = timedelta(0), *, strict: bool = True) -> ExprOrSeries:
        """Converts `str` series or expr of ISO Week date format YYYY-WNN-D to a series or expr of `pl.Date` values.

        `offset` represents how many days to add to the date before converting to `pl.Date`, and it can be negative.

        Arguments:
            offset: Offset in days or `timedelta`. It represents how many days to add to the date before converting to
                IsoWeek, it can be negative.
            strict: Raise an error if the values cannot be converted to datetime. Otherwise mask out with a null value.

        Returns:
            Series or Expr of converted date values

        Raises:
            TypeError: If `offset` is not of type `timedelta` or `int`

        Examples:
            >>> from datetime import timedelta
            >>> import polars as pl
            >>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
            >>>
            >>> s = pl.Series(["2022-W52-7", "2023-W01-1", "2023-W02-1"])
            >>> s.iwd.isoweekdate_to_datetime(offset=timedelta(days=1))  # doctest: +NORMALIZE_WHITESPACE
            shape: (3,)
            Series: '' [date]
            [
                2023-01-02
                2023-01-03
                2023-01-10
            ]
        """
        return isoweekdate_to_datetime(self._series, offset=offset, strict=strict)

    @overload
    def is_isoweek(self: SeriesIsoWeek[pl.Series]) -> bool: ...

    @overload
    def is_isoweek(self: SeriesIsoWeek[pl.Expr]) -> pl.Expr: ...

    def is_isoweek(self: Self) -> bool | pl.Expr:
        """Checks if a series or expr contains only values in ISO Week format.

        Returns:
            For a `pl.Series`, `True` if all values match ISO Week format and `False` otherwise. For
                a `pl.Expr`, a boolean `Expr` computing the same answer, to be used inside `select` /
                `filter`.

        Examples:
            >>> import polars as pl
            >>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
            >>>
            >>> s = pl.Series(["2022-W52", "2023-W01", "2023-W02"])
            >>> s.iwd.is_isoweek()
            True

            >>> df = pl.DataFrame({"isoweek": ["2022-W52", "2023-W01"]})
            >>> df.select(check=pl.col("isoweek").iwd.is_isoweek())["check"].item()
            True
        """
        return is_isoweek_series(self._series)

    @overload
    def is_isoweekdate(self: SeriesIsoWeek[pl.Series]) -> bool: ...

    @overload
    def is_isoweekdate(self: SeriesIsoWeek[pl.Expr]) -> pl.Expr: ...

    def is_isoweekdate(self: Self) -> bool | pl.Expr:
        """Checks if a series or expr contains only values in ISO Week date format.

        Returns:
            For a `pl.Series`, `True` if all values match ISO Week date format and `False` otherwise.
                For a `pl.Expr`, a boolean `Expr` computing the same answer, to be used inside
                `select` / `filter`.

        Examples:
            >>> import polars as pl
            >>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
            >>>
            >>> s = pl.Series(["2022-W52-1", "2023-W01-1", "2023-W02-1"])
            >>> s.iwd.is_isoweekdate()
            True

            >>> df = pl.DataFrame({"isoweekdate": ["2022-W52-1", "2023-W01-1"]})
            >>> df.select(check=pl.col("isoweekdate").iwd.is_isoweekdate())["check"].item()
            True
        """
        return is_isoweekdate_series(self._series)

datetime_to_isoweek

datetime_to_isoweek(offset: OffsetType = timedelta(0)) -> ExprOrSeries

Converts date(time) series/expr to str values representing ISO Week format YYYY-WNN.

Parameters:

Name Type Description Default
offset OffsetType

offset in days or timedelta. It represents how many days to add to the date before converting to ISO Week, it can be negative

timedelta(0)

Returns:

Type Description
ExprOrSeries

Series or Expr with converted ISO Week values (in format YYYY-WNN)

Raises:

Type Description
TypeError

If offset is not of type timedelta or int

Examples:

>>> from datetime import date, timedelta
>>> import polars as pl
>>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
>>>
>>> s = pl.date_range(date(2023, 1, 1), date(2023, 1, 5), interval="1d", eager=True)
>>> s.iwd.datetime_to_isoweek(offset=timedelta(days=1))
shape: (5,)
Series: 'literal' [str]
[
    "2022-W52"
    "2022-W52"
    "2023-W01"
    "2023-W01"
    "2023-W01"
]
>>> df = pl.DataFrame({"date": s})
>>> df.select(pl.col("date").iwd.datetime_to_isoweek(offset=1))
shape: (5, 1)
┌──────────┐
│ date     │
│ ---      │
│ str      │
╞══════════╡
│ 2022-W52 │
│ 2022-W52 │
│ 2023-W01 │
│ 2023-W01 │
│ 2023-W01 │
└──────────┘
Source code in src/iso_week_date/polars_utils.py
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
def datetime_to_isoweek(self: Self, offset: OffsetType = timedelta(0)) -> ExprOrSeries:
    """Converts `date(time)` `series/expr` to `str` values representing ISO Week format YYYY-WNN.

    Arguments:
        offset: offset in days or `timedelta`. It represents how many days to add to the date before converting to
            ISO Week, it can be negative

    Returns:
        Series or Expr with converted ISO Week values (in format YYYY-WNN)

    Raises:
        TypeError: If `offset` is not of type `timedelta` or `int`

    Examples:
        >>> from datetime import date, timedelta
        >>> import polars as pl
        >>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
        >>>
        >>> s = pl.date_range(date(2023, 1, 1), date(2023, 1, 5), interval="1d", eager=True)
        >>> s.iwd.datetime_to_isoweek(offset=timedelta(days=1))  # doctest: +NORMALIZE_WHITESPACE
        shape: (5,)
        Series: 'literal' [str]
        [
            "2022-W52"
            "2022-W52"
            "2023-W01"
            "2023-W01"
            "2023-W01"
        ]
        >>> df = pl.DataFrame({"date": s})
        >>> df.select(pl.col("date").iwd.datetime_to_isoweek(offset=1))
        shape: (5, 1)
        ┌──────────┐
        │ date     │
        │ ---      │
        │ str      │
        ╞══════════╡
        │ 2022-W52 │
        │ 2022-W52 │
        │ 2023-W01 │
        │ 2023-W01 │
        │ 2023-W01 │
        └──────────┘
    """
    return datetime_to_isoweek(self._series, offset=offset)

datetime_to_isoweekdate

datetime_to_isoweekdate(offset: OffsetType = timedelta(0)) -> ExprOrSeries

Converts date(time) series/expr to str values representing ISO Week date format YYYY-WNN-D.

Parameters:

Name Type Description Default
offset OffsetType

offset in days or timedelta. It represents how many days to add to the date before converting to ISO Week, it can be negative

timedelta(0)

Returns:

Type Description
ExprOrSeries

Series or Expr with converted ISO Week values (in format YYYY-WNN-D)

Raises:

Type Description
TypeError

If offset is not of type timedelta or int

Examples:

>>> from datetime import date, timedelta
>>> import polars as pl
>>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
>>>
>>> s = pl.date_range(date(2023, 1, 1), date(2023, 1, 5), interval="1d", eager=True)
>>> s.iwd.datetime_to_isoweekdate(offset=timedelta(days=1))
shape: (5,)
Series: 'literal' [str]
[
    "2022-W52-6"
    "2022-W52-7"
    "2023-W01-1"
    "2023-W01-2"
    "2023-W01-3"
]
>>> df = pl.DataFrame({"date": s})
>>> df.select(pl.col("date").iwd.datetime_to_isoweekdate(offset=1))
shape: (5, 1)
┌────────────┐
│ date       │
│ ---        │
│ str        │
╞════════════╡
│ 2022-W52-6 │
│ 2022-W52-7 │
│ 2023-W01-1 │
│ 2023-W01-2 │
│ 2023-W01-3 │
└────────────┘
Source code in src/iso_week_date/polars_utils.py
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
def datetime_to_isoweekdate(self: Self, offset: OffsetType = timedelta(0)) -> ExprOrSeries:
    """Converts `date(time)` `series/expr` to `str` values representing ISO Week date format YYYY-WNN-D.

    Arguments:
        offset: offset in days or `timedelta`. It represents how many days to add to the date before converting to
            ISO Week, it can be negative

    Returns:
        Series or Expr with converted ISO Week values (in format YYYY-WNN-D)

    Raises:
        TypeError: If `offset` is not of type `timedelta` or `int`

    Examples:
        >>> from datetime import date, timedelta
        >>> import polars as pl
        >>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
        >>>
        >>> s = pl.date_range(date(2023, 1, 1), date(2023, 1, 5), interval="1d", eager=True)
        >>> s.iwd.datetime_to_isoweekdate(offset=timedelta(days=1))  # doctest: +NORMALIZE_WHITESPACE
        shape: (5,)
        Series: 'literal' [str]
        [
            "2022-W52-6"
            "2022-W52-7"
            "2023-W01-1"
            "2023-W01-2"
            "2023-W01-3"
        ]
        >>> df = pl.DataFrame({"date": s})
        >>> df.select(pl.col("date").iwd.datetime_to_isoweekdate(offset=1))
        shape: (5, 1)
        ┌────────────┐
        │ date       │
        │ ---        │
        │ str        │
        ╞════════════╡
        │ 2022-W52-6 │
        │ 2022-W52-7 │
        │ 2023-W01-1 │
        │ 2023-W01-2 │
        │ 2023-W01-3 │
        └────────────┘
    """
    return datetime_to_isoweekdate(self._series, offset=offset)

is_isoweek

is_isoweek() -> bool
is_isoweek() -> pl.Expr
is_isoweek() -> bool | pl.Expr

Checks if a series or expr contains only values in ISO Week format.

Returns:

Type Description
bool | Expr

For a pl.Series, True if all values match ISO Week format and False otherwise. For a pl.Expr, a boolean Expr computing the same answer, to be used inside select / filter.

Examples:

>>> import polars as pl
>>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
>>>
>>> s = pl.Series(["2022-W52", "2023-W01", "2023-W02"])
>>> s.iwd.is_isoweek()
True
>>> df = pl.DataFrame({"isoweek": ["2022-W52", "2023-W01"]})
>>> df.select(check=pl.col("isoweek").iwd.is_isoweek())["check"].item()
True
Source code in src/iso_week_date/polars_utils.py
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
def is_isoweek(self: Self) -> bool | pl.Expr:
    """Checks if a series or expr contains only values in ISO Week format.

    Returns:
        For a `pl.Series`, `True` if all values match ISO Week format and `False` otherwise. For
            a `pl.Expr`, a boolean `Expr` computing the same answer, to be used inside `select` /
            `filter`.

    Examples:
        >>> import polars as pl
        >>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
        >>>
        >>> s = pl.Series(["2022-W52", "2023-W01", "2023-W02"])
        >>> s.iwd.is_isoweek()
        True

        >>> df = pl.DataFrame({"isoweek": ["2022-W52", "2023-W01"]})
        >>> df.select(check=pl.col("isoweek").iwd.is_isoweek())["check"].item()
        True
    """
    return is_isoweek_series(self._series)

is_isoweekdate

is_isoweekdate() -> bool
is_isoweekdate() -> pl.Expr
is_isoweekdate() -> bool | pl.Expr

Checks if a series or expr contains only values in ISO Week date format.

Returns:

Type Description
bool | Expr

For a pl.Series, True if all values match ISO Week date format and False otherwise. For a pl.Expr, a boolean Expr computing the same answer, to be used inside select / filter.

Examples:

>>> import polars as pl
>>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
>>>
>>> s = pl.Series(["2022-W52-1", "2023-W01-1", "2023-W02-1"])
>>> s.iwd.is_isoweekdate()
True
>>> df = pl.DataFrame({"isoweekdate": ["2022-W52-1", "2023-W01-1"]})
>>> df.select(check=pl.col("isoweekdate").iwd.is_isoweekdate())["check"].item()
True
Source code in src/iso_week_date/polars_utils.py
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
def is_isoweekdate(self: Self) -> bool | pl.Expr:
    """Checks if a series or expr contains only values in ISO Week date format.

    Returns:
        For a `pl.Series`, `True` if all values match ISO Week date format and `False` otherwise.
            For a `pl.Expr`, a boolean `Expr` computing the same answer, to be used inside
            `select` / `filter`.

    Examples:
        >>> import polars as pl
        >>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
        >>>
        >>> s = pl.Series(["2022-W52-1", "2023-W01-1", "2023-W02-1"])
        >>> s.iwd.is_isoweekdate()
        True

        >>> df = pl.DataFrame({"isoweekdate": ["2022-W52-1", "2023-W01-1"]})
        >>> df.select(check=pl.col("isoweekdate").iwd.is_isoweekdate())["check"].item()
        True
    """
    return is_isoweekdate_series(self._series)

isoweek_to_datetime

isoweek_to_datetime(offset: OffsetType = timedelta(0), weekday: int = 1, *, strict: bool = True) -> ExprOrSeries

Converts series or expr of str values in ISO Week format YYYY-WNN to a series or expr of pl.Date values.

offset represents how many days to add to the date before converting to pl.Date, and it can be negative.

weekday represents the weekday to use for conversion in ISO Week format (1-7), where 1 is the first day of the week, 7 is the last one.

Parameters:

Name Type Description Default
offset OffsetType

Offset in days or timedelta. It represents how many days to add to the date before converting to IsoWeek, it can be negative.

timedelta(0)
weekday int

Weekday to use for conversion (1-7).

1
strict bool

Raise an error if the values cannot be converted to datetime. Otherwise mask out with a null value.

True

Returns:

Type Description
ExprOrSeries

Series or Expr of converted date values

Raises:

Type Description
TypeError

If offset is not of type timedelta or int

ValueError

If weekday is not an integer between 1 and 7

Examples:

>>> from datetime import timedelta
>>> import polars as pl
>>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
>>>
>>> s = pl.Series(["2022-W52", "2023-W01", "2023-W02"])
>>> s.iwd.isoweek_to_datetime(offset=timedelta(days=1))
shape: (3,)
Series: '' [date]
[
    2022-12-27
    2023-01-03
    2023-01-10
]
Source code in src/iso_week_date/polars_utils.py
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
def isoweek_to_datetime(
    self: Self,
    offset: OffsetType = timedelta(0),
    weekday: int = 1,
    *,
    strict: bool = True,
) -> ExprOrSeries:
    """Converts series or expr of `str` values in ISO Week format YYYY-WNN to a series or expr of `pl.Date` values.

    `offset` represents how many days to add to the date before converting to `pl.Date`, and it can be negative.

    `weekday` represents the weekday to use for conversion in ISO Week format (1-7), where 1 is the first day of the
    week, 7 is the last one.

    Arguments:
        offset: Offset in days or `timedelta`. It represents how many days to add to the date before converting to
            IsoWeek, it can be negative.
        weekday: Weekday to use for conversion (1-7).
        strict: Raise an error if the values cannot be converted to datetime. Otherwise mask out with a null value.

    Returns:
        Series or Expr of converted date values

    Raises:
        TypeError: If `offset` is not of type `timedelta` or `int`
        ValueError: If `weekday` is not an integer between 1 and 7

    Examples:
        >>> from datetime import timedelta
        >>> import polars as pl
        >>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
        >>>
        >>> s = pl.Series(["2022-W52", "2023-W01", "2023-W02"])
        >>> s.iwd.isoweek_to_datetime(offset=timedelta(days=1))  # doctest: +NORMALIZE_WHITESPACE
        shape: (3,)
        Series: '' [date]
        [
            2022-12-27
            2023-01-03
            2023-01-10
        ]
    """
    return isoweek_to_datetime(self._series, offset=offset, weekday=weekday, strict=strict)

isoweekdate_to_datetime

isoweekdate_to_datetime(offset: OffsetType = timedelta(0), *, strict: bool = True) -> ExprOrSeries

Converts str series or expr of ISO Week date format YYYY-WNN-D to a series or expr of pl.Date values.

offset represents how many days to add to the date before converting to pl.Date, and it can be negative.

Parameters:

Name Type Description Default
offset OffsetType

Offset in days or timedelta. It represents how many days to add to the date before converting to IsoWeek, it can be negative.

timedelta(0)
strict bool

Raise an error if the values cannot be converted to datetime. Otherwise mask out with a null value.

True

Returns:

Type Description
ExprOrSeries

Series or Expr of converted date values

Raises:

Type Description
TypeError

If offset is not of type timedelta or int

Examples:

>>> from datetime import timedelta
>>> import polars as pl
>>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
>>>
>>> s = pl.Series(["2022-W52-7", "2023-W01-1", "2023-W02-1"])
>>> s.iwd.isoweekdate_to_datetime(offset=timedelta(days=1))
shape: (3,)
Series: '' [date]
[
    2023-01-02
    2023-01-03
    2023-01-10
]
Source code in src/iso_week_date/polars_utils.py
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
def isoweekdate_to_datetime(self: Self, offset: OffsetType = timedelta(0), *, strict: bool = True) -> ExprOrSeries:
    """Converts `str` series or expr of ISO Week date format YYYY-WNN-D to a series or expr of `pl.Date` values.

    `offset` represents how many days to add to the date before converting to `pl.Date`, and it can be negative.

    Arguments:
        offset: Offset in days or `timedelta`. It represents how many days to add to the date before converting to
            IsoWeek, it can be negative.
        strict: Raise an error if the values cannot be converted to datetime. Otherwise mask out with a null value.

    Returns:
        Series or Expr of converted date values

    Raises:
        TypeError: If `offset` is not of type `timedelta` or `int`

    Examples:
        >>> from datetime import timedelta
        >>> import polars as pl
        >>> from iso_week_date.polars_utils import SeriesIsoWeek  # noqa: F401
        >>>
        >>> s = pl.Series(["2022-W52-7", "2023-W01-1", "2023-W02-1"])
        >>> s.iwd.isoweekdate_to_datetime(offset=timedelta(days=1))  # doctest: +NORMALIZE_WHITESPACE
        shape: (3,)
        Series: '' [date]
        [
            2023-01-02
            2023-01-03
            2023-01-10
        ]
    """
    return isoweekdate_to_datetime(self._series, offset=offset, strict=strict)