pyarrow.compute.assume_timezone

pyarrow.compute.assume_timezone(timestamps, /, timezone, *, ambiguous='raise', nonexistent='raise', options=None, memory_pool=None)

Convert naive timestamp to timezone-aware timestamp.

Input timestamps are assumed to be relative to the timezone given in the timezone option. They are converted to UTC-relative timestamps and the output type has its timezone set to the value of the timezone option. Null values emit null. This function is meant to be used when an external system produces “timezone-naive” timestamps which need to be converted to “timezone-aware” timestamps. An error is returned if the timestamps already have a defined timezone.

Parameters:
timestampsArray-like or scalar-like

Argument to compute function.

timezonestr

Timezone to assume for the input.

ambiguousstr, default “raise”

How to handle timestamps that are ambiguous in the assumed timezone. Accepted values are “raise”, “earliest”, “latest”.

nonexistentstr, default “raise”

How to handle timestamps that don’t exist in the assumed timezone. Accepted values are “raise”, “earliest”, “latest”.

optionspyarrow.compute.AssumeTimezoneOptions, optional

Alternative way of passing options.

memory_poolpyarrow.MemoryPool, optional

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