polars.datatypes.Datetime#

class polars.datatypes.Datetime(time_unit: TimeUnit = 'us', time_zone: str | timezone | None = None)[source]#

Data type representing a calendar date and time of day.

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

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

time_zone

Time zone string, as defined in zoneinfo (to see valid strings run import zoneinfo; zoneinfo.available_timezones() for a full list). When used to match dtypes, can set this to “*” to check for Datetime columns that have any (non-null) timezone.

Notes

The underlying representation of this type is a 64-bit signed integer. The integer indicates the number of time units since the Unix epoch (1970-01-01 00:00:00). The number can be negative to indicate datetimes before the epoch.

__init__(
time_unit: TimeUnit = 'us',
time_zone: str | timezone | None = None,
) None[source]#

Methods

__init__([time_unit, time_zone])

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

time_zone