pyarrow.timestamp#

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]

tzstr, defaultNone

Time zone name. None indicates time zone naive

Returns:
timestamp_typeTimestampType

Examples

Create an instance of timestamp type:

>>>importpyarrowaspa>>>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:

>>>fromdatetimeimportdatetime>>>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'>