Skip to content

temporian.EventSet.calendar_second #

calendar_second(
    tz: Union[str, float, int] = 0
) -> EventSetOrNode

Obtains the second 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 0 and 59.

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
>>> from datetime import datetime
>>> a = tp.event_set(
...    timestamps=[datetime(2020,1,1,18,30,55), datetime(2020,1,1,23,59,0)],
...    name='random_hours'
... )
>>> b = a.calendar_second()
>>> b
indexes: ...
features: [('calendar_second', int32)]
events:
    (2 events):
        timestamps: [...]
        'calendar_second': [55 0]
...

Parameters:

Name Type Description Default
tz Union[str, float, int]

timezone name (see pytz.all_timezones) or UTC offset in hours.

0

Returns:

Type Description
EventSetOrNode

EventSet with a single feature with the second each timestamp in sampling belongs to.