pandas.Timestamp.unit#

Timestamp.unit#

The abbreviation associated with self._creso.

This property returns a string representing the time unit of the Timestamp’s resolution. It corresponds to the smallest time unit that can be represented by this Timestamp object. The possible values are: - ‘s’ (second) - ‘ms’ (millisecond) - ‘us’ (microsecond) - ‘ns’ (nanosecond)

Returns:
str

A string abbreviation of the Timestamp’s resolution unit: - ‘s’ for second - ‘ms’ for millisecond - ‘us’ for microsecond - ‘ns’ for nanosecond

See also

Timestamp.resolution

Return resolution of the Timestamp.

Timedelta

A duration expressing the difference between two dates or times.

Examples

>>> pd.Timestamp("2020-01-01 12:34:56").unit
's'
>>> pd.Timestamp("2020-01-01 12:34:56.123").unit
'ms'
>>> pd.Timestamp("2020-01-01 12:34:56.123456").unit
'us'
>>> pd.Timestamp("2020-01-01 12:34:56.123456789").unit
'ns'