pyarrow.timestamp¶
- pyarrow.timestamp(unit, tz=None)¶
Create instance of timestamp type with resolution and optional time zone.
- Parameters:
- Returns:
- timestamp_type
TimestampType
- timestamp_type
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: datetime.datetime(2012, 1, 1, 0, 0, tzinfo=<UTC>)> >>> pa.scalar(datetime(2012, 1, 1), type=pa.timestamp('us')) <pyarrow.TimestampScalar: datetime.datetime(2012, 1, 1, 0, 0)>