Expr.Dt (DtOps)
Namespace: Polars.FSharp
Instance Methods
AddBusinessDays
Add business days to a date column.
Overload: Add business days using an integer literal.
member AddBusinessDays(
n: Expr,
?weekMask: bool[],
?holidays: seq<DateOnly>,
?roll: Roll
) : Expr
member AddBusinessDays(
n: int,
?weekMask: bool[],
?holidays: seq<DateOnly>,
?roll: Roll
) : ExprParameters
| Name | Type | Description |
|---|---|---|
n | Expr / int | Number of business days to add. |
weekMask | bool[] (optional) | Array of 7 bools (Mon-Sun) indicating business days. Default: [true, true, true, true, true, false, false]. |
holidays | seq<DateOnly> (optional) | List of holidays to skip. |
roll | Roll (optional) | Strategy for handling non-business start dates. Default: Raise. |
BaseUtcOffset
Base offset from UTC. This is usually constant for all datetimes in a given time zone, but may vary in the rare case that a country switches time zone, like Samoa (Apia) did at the end of 2011.
member BaseUtcOffset : unit -> ExprReturns: Expression/Series of data type Duration.
Century
Extract the century from underlying representation.Returns the century number in the calendar date.
member Century : unit -> ExprReturns: Expression/Series of data type Int32.
Combine
Combine the date from the underlying date/datetime with the time from another expression.
The resulting Series will have the specified TimeUnit.
member Combine(time: Expr, ?timeUnit: TimeUnit) : ExprParameters
| Name | Type | Description |
|---|---|---|
time | Expr | An expression yielding the Time component. |
timeUnit | TimeUnit (optional) | The desired TimeUnit for the resulting Datetime. Note: Only sub-second units ( TimeUnit.Nanoseconds, TimeUnit.Microseconds, TimeUnit.Milliseconds) are supported. |
ConvertTimeZone
Convert the datetime to a different time zone. The underlying physical value (UTC timestamp) remains the same, but the display time changes.
member ConvertTimeZone(timeZone: string) : ExprParameters
| Name | Type | Description |
|---|---|---|
timeZone | string | - |
Date
Cast to Date (remove time component).
member Date : unit -> ExprDay
Get the day from the underlying date/datetime.
member Day : unit -> ExprDayInMonth
Extract the number of days in the month from the underlying Date representation.Returns the number of days in the month. The return value ranges from 28 to 31.
member DayInMonth : unit -> ExprReturns: Expression/Series of data type Int8.
DstOffset
Additional offset currently in effect (typically due to daylight saving time).
member DstOffset : unit -> ExprReturns: Expression/Series of data type Duration.
Epoch
Get the time passed since the Unix epoch (1970-01-01 00:00:00).
member Epoch(?timeUnit: EpochTimeUnit) : ExprParameters
| Name | Type | Description |
|---|---|---|
timeUnit | EpochTimeUnit (optional) | The time unit to compute the epoch for. Supported units: Nanoseconds, Microseconds, Milliseconds, Second, Day. (default: Microseconds) |
Returns: A new expression/Series representing the epoch time.
Hour
Get the hour from the underlying datetime.
member Hour : unit -> ExprIsBusinessDay
Check if the date is a business day.
member IsBusinessDay(?weekMask: bool[], ?holidays: seq<DateOnly>) : ExprParameters
| Name | Type | Description |
|---|---|---|
weekMask | bool[] (optional) | Array of 7 bools (Mon-Sun). Default: Mon-Fri are business days. |
holidays | seq<DateOnly> (optional) | List of holidays. |
IsLeapYear
Determine whether the year of the underlying date is a leap year.
member IsLeapYear : unit -> ExprReturns: Expression/Series of data type Boolean.
IsoYear
Get the ISO year from the underlying date/datetime.
member IsoYear : unit -> ExprMicrosecond
Get the microsecond from the underlying datetime.
member Microsecond : unit -> ExprMillennium
Extract the millennium from underlying representation. Applies to Date and Datetime columns. Returns the millennium number in the calendar date.
member Millennium : unit -> ExprReturns: Expression/Series of data type Int32.
Millisecond
Get the millisecond from the underlying datetime.
member Millisecond : unit -> ExprMinute
Get the minute from the underlying datetime.
member Minute : unit -> ExprMonth
Get the month from the underlying date/datetime.
member Month : unit -> ExprMonthEnd
Roll forward to the last day of the month. For datetimes, the time-of-day is preserved.
member MonthEnd : unit -> ExprReturns: Expression/Series of data type Date or Datetime.
MonthStart
Roll backward to the first day of the month. For datetimes, the time-of-day is preserved.
member MonthStart : unit -> ExprReturns: Expression/Series of data type Date or Datetime.
Nanosecond
Get the nanosecond from the underlying datetime.
member Nanosecond : unit -> ExprOffsetBy
Offset the date by a given duration string (e.g., "1d", "-2h").
member OffsetBy(duration: Dur) : ExprParameters
| Name | Type | Description |
|---|---|---|
duration | Dur | - |
OrdinalDay
Get the ordinal day(day of year) from the underlying date/datetime.
member OrdinalDay : unit -> ExprQuarter
Get the quarter from the underlying date/datetime.
member Quarter : unit -> ExprReplace
Replace the datetime components of the underlying Datetime/Date.
member Replace(
?year: int,
?month: int,
?day: int,
?hour: int,
?minute: int,
?second: int,
?microsecond: int,
?ambiguous: Expr
) : ExprParameters
| Name | Type | Description |
|---|---|---|
year | int (optional) | Year to replace |
month | int (optional) | Month to replace |
day | int (optional) | Day to replace |
hour | int (optional) | Hour to replace |
minute | int (optional) | Minute to replace |
second | int (optional) | Second to replace |
microsecond | int (optional) | Microsecond to replace |
ambiguous | Expr (optional) | Determine how to deal with ambiguous datetimes. |
Returns: A new expression.
ReplaceTimeZone
Replace the time zone of a datetime. Use None (null) to make it TimeZone-Naive. ambiguous: Strategy for DST overlaps ("raise", "earliest", "latest", "null"). nonExistent: Strategy for missing DST times ("raise", "null").
Helper: Replace time zone with a specific string.
member ReplaceTimeZone(timeZone: string option, ?ambiguous: Expr, ?nonExistent: NonExistent) : Expr
member ReplaceTimeZone(timeZone: string, ?ambiguous: Expr, ?nonExistent: NonExistent) : ExprParameters
| Name | Type | Description |
|---|---|---|
timeZone | string option | - |
ambiguous | Expr (optional) | - |
nonExistent | NonExistent (optional) | - |
Round
Round dates to the nearest interval.
member Round(every: Dur) : ExprParameters
| Name | Type | Description |
|---|---|---|
every | Dur | - |
Second
Get the second from the underlying datetime.
member Second(?fractional: bool) : ExprParameters
| Name | Type | Description |
|---|---|---|
fractional | bool (optional) | Whether to include the fractional component of the second. |
Strftime
Alias for ToString.
member Strftime(?format: string) : ExprParameters
| Name | Type | Description |
|---|---|---|
format | string (optional) | - |
Time
Cast to Time (remove Date component).
member Time : unit -> ExprTimestamp
Convert to integer timestamp.
member Timestamp(?timeUnit: TimeUnit) : ExprParameters
| Name | Type | Description |
|---|---|---|
timeUnit | TimeUnit (optional) | - |
TotalDays
Extract the total days from a Duration type.
member TotalDays(?fractional: bool) : ExprParameters
| Name | Type | Description |
|---|---|---|
fractional | bool (optional) | Whether to include the fractional component of the day. |
Returns: Expression/Series of data type Int64 or Float64 if fractional is set.
TotalHours
Extract the total hours from a Duration type.
member TotalHours(?fractional: bool) : ExprParameters
| Name | Type | Description |
|---|---|---|
fractional | bool (optional) | Whether to include the fractional component of the hour. |
Returns: Expression/Series of data type Int64 or Float64 if fractional is set.
TotalMicroseconds
Extract the total microseconds from a Duration type.
member TotalMicroseconds(?fractional: bool) : ExprParameters
| Name | Type | Description |
|---|---|---|
fractional | bool (optional) | Whether to include the fractional component of the microsecond. |
Returns: Expression/Series of data type Int64 or Float64 if fractional is set.
TotalMilliseconds
Extract the total milliseconds from a Duration type.
member TotalMilliseconds(?fractional: bool) : ExprParameters
| Name | Type | Description |
|---|---|---|
fractional | bool (optional) | Whether to include the fractional component of the millisecond. |
Returns: Expression/Series of data type Int64 or Float64 if fractional is set.
TotalMinutes
Extract the total minutes from a Duration type.
member TotalMinutes(?fractional: bool) : ExprParameters
| Name | Type | Description |
|---|---|---|
fractional | bool (optional) | Whether to include the fractional component of the minute. |
Returns: Expression/Series of data type Int64 or Float64 if fractional is set.
TotalNanoseconds
Extract the total nanoseconds from a Duration type.
member TotalNanoseconds(?fractional: bool) : ExprParameters
| Name | Type | Description |
|---|---|---|
fractional | bool (optional) | Whether to include return the result as a Float64. Because the smallest TimeUnit is 'ns', the fractional component will always be zero. |
Returns: Expression/Series of data type Int64 or Float64 if fractional is set.
TotalSeconds
Extract the total seconds from a Duration type.
member TotalSeconds(?fractional: bool) : ExprParameters
| Name | Type | Description |
|---|---|---|
fractional | bool (optional) | Whether to include the fractional component of the second. |
Returns: Expression/Series of data type Int64 or Float64 if fractional is set.
Truncate
Truncate dates to the specified interval (e.g., "1d", "1h", "15m").
member Truncate(every: Dur) : ExprParameters
| Name | Type | Description |
|---|---|---|
every | Dur | - |
Weekday
Get the weekday from the underlying date/datetime.
member Weekday : unit -> ExprYear
Get the year from the underlying date/datetime.
member Year : unit -> Expr