pyarrow.timestamp — Apache Arrow v20.0.0 (original) (raw)
pyarrow.timestamp(unit, tz=None)#
Create instance of timestamp type with resolution and optional time zone.
Parameters:
unitstr
one of ‘s’ [second], ‘ms’ [millisecond], ‘us’ [microsecond], or ‘ns’ [nanosecond]
Time zone name. None indicates time zone naive
Returns:
timestamp_typeTimestampType
Examples
Create an instance of timestamp type:
import pyarrow as pa pa.timestamp('us') TimestampType(timestamp[us]) pa.timestamp('s', tz='America/New_York') TimestampType(timestamp[s, tz=America/New_York]) pa.timestamp('s', tz='+07:30') TimestampType(timestamp[s, tz=+07:30])
Use timestamp type when creating a scalar object:
from datetime import datetime pa.scalar(datetime(2012, 1, 1), type=pa.timestamp('s', tz='UTC')) <pyarrow.TimestampScalar: '2012-01-01T00:00:00+0000'> pa.scalar(datetime(2012, 1, 1), type=pa.timestamp('us')) <pyarrow.TimestampScalar: '2012-01-01T00:00:00.000000'>