temporian.EventSet.calendar_iso_week #
calendar_iso_week(
tz: Union[str, float, int] = 0
) -> EventSetOrNode
Obtains the ISO week the timestamps in an
EventSet
's sampling are in.
Features in the input are ignored, only the timestamps are used and
they must be unix timestamps (is_unix_timestamp=True
).
Output feature contains numbers between 1 and 53.
By default, the timezone is UTC unless the tz
argument is specified,
as an offset in hours or a timezone name. See
EventSet.calendar_hour()
for an
example using timezones.
Usage example
>>> a = tp.event_set(
... # Note: 2023-01-01 is Sunday in the same week as 2022-12-31
... timestamps=["2022-12-31", "2023-01-01", "2023-01-02", "2023-12-20"],
... )
>>> b = a.calendar_iso_week()
>>> b
indexes: ...
features: [('calendar_iso_week', int32)]
events:
(4 events):
timestamps: [...]
'calendar_iso_week': [52 52 1 51]
...
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tz |
Union[str, float, int]
|
timezone name (see |
0
|
Returns:
Type | Description |
---|---|
EventSetOrNode
|
EventSet with a single feature with the ISO week each timestamp in
|