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.
- timezone
str
Timezone to assume for the input.
- ambiguous
str
, default “raise” How to handle timestamps that are ambiguous in the assumed timezone. Accepted values are “raise”, “earliest”, “latest”.
- nonexistent
str
, default “raise” How to handle timestamps that don’t exist in the assumed timezone. Accepted values are “raise”, “earliest”, “latest”.
- options
pyarrow.compute.AssumeTimezoneOptions
, optional Alternative way of passing options.
- memory_pool
pyarrow.MemoryPool
, optional If not passed, will allocate memory from the default memory pool.