polars.datatypes.Duration#

class polars.datatypes.Duration(time_unit: TimeUnit = 'us')[source]#

Data type representing a time duration.

Parameters:
time_unit{‘us’, ‘ns’, ‘ms’}

Unit of time. Defaults to 'us' (microseconds).

Notes

The underlying representation of this type is a 64-bit signed integer. The integer indicates an amount of time units and can be negative to indicate negative time offsets.

__init__(time_unit: TimeUnit = 'us') None[source]#

Methods

__init__([time_unit])

base_type()

Return this DataType's fundamental/root type class.

from_python(py_type)

Return the Polars data type corresponding to a given Python type.

is_(other)

Check if this DataType is the same as another DataType.

is_decimal()

Check whether the data type is a decimal type.

is_float()

Check whether the data type is a floating point type.

is_integer()

Check whether the data type is an integer type.

is_nested()

Check whether the data type is a nested type.

is_numeric()

Check whether the data type is a numeric type.

is_signed_integer()

Check whether the data type is a signed integer type.

is_temporal()

Check whether the data type is a temporal type.

is_unsigned_integer()

Check whether the data type is an unsigned integer type.

to_python()

Return the Python type corresponding to this Polars data type.

Attributes

time_unit