polars.datetime#
- polars.datetime(
- year: int | IntoExpr,
- month: int | IntoExpr,
- day: int | IntoExpr,
- hour: int | IntoExpr | None = None,
- minute: int | IntoExpr | None = None,
- second: int | IntoExpr | None = None,
- microsecond: int | IntoExpr | None = None,
- *,
- time_unit: TimeUnit = 'us',
- time_zone: str | None = None,
- use_earliest: bool | None = None,
- ambiguous: Ambiguous | Expr = 'raise',
Create a Polars literal expression of type Datetime.
- Parameters:
- year
Column or literal.
- month
Column or literal, ranging from 1-12.
- day
Column or literal, ranging from 1-31.
- hour
Column or literal, ranging from 0-23.
- minute
Column or literal, ranging from 0-59.
- second
Column or literal, ranging from 0-59.
- microsecond
Column or literal, ranging from 0-999999.
- time_unit{‘us’, ‘ms’, ‘ns’}
Time unit of the resulting expression.
- time_zone
Time zone of the resulting expression.
- use_earliest
Determine how to deal with ambiguous datetimes:
None
(default): raiseTrue
: use the earliest datetimeFalse
: use the latest datetime
Deprecated since version 0.19.0: Use
ambiguous
instead- ambiguous
Determine how to deal with ambiguous datetimes:
'raise'
(default): raise'earliest'
: use the earliest datetime'latest'
: use the latest datetime
- Returns:
- Expr
Expression of data type
Datetime
.