Duration
struct Duration
A duration type.
operator <=
pub fn operator <=(self, b: Duration): bool
operator <=
pub fn operator <=(self, b: Duration): bool
operator <
pub fn operator <(self, b: Duration): bool
operator <
pub fn operator <(self, b: Duration): bool
operator >=
pub fn operator >=(self, b: Duration): bool
operator >=
pub fn operator >=(self, b: Duration): bool
operator >
pub fn operator >(self, b: Duration): bool
operator >
pub fn operator >(self, b: Duration): bool
operator !=
pub fn operator !=(self, b: Duration): bool
operator !=
pub fn operator !=(self, b: Duration): bool
operator ==
pub fn operator ==(self, b: Duration): bool
operator ==
pub fn operator ==(self, b: Duration): bool
Create a new integer size Duration
.
Create a new integer size Duration
.
Create a new integer size Duration
.
parse
pub fn parse(s: string): Duration throws PolarsError
Parse a string into a Duration
.
parse
pub fn parse(s: string): Duration throws PolarsError
Parse a string into a Duration
.
Parse a string into a Duration
.
Strings are composed of a sequence of number-unit pairs, such as 5d
(5 days).
A string may begin with a minus sign, in which case it is interpreted as a negative duration.
Some examples:
- "1y": 1 year
- "-1w2d": negative 1 week, 2 days (i.e. -9 days) -"3d12h4m25s": 3 days, 12 hours, 4 minutes, and 25 seconds
Aside from a leading minus sign, strings may not contain any characters other than numbers and letters (including whitespace).
The available units, in ascending order of magnitude, are as follows:
ns
: nanosecond
us
: microsecond
ms
: millisecond
s
: second
m
: minute
h
: hour
d
: day
w
: week
mo
: calendar month
q
: calendar quarter
y
: calendar year
i
: index value (only for {Int32, Int64} dtypes)
By “calendar day”, we mean the corresponding time on the next day (which may not be 24 hours, depending on daylight savings). Similarly for “calendar week”, “calendar month”, “calendar quarter”, and “calendar year”.
parse_interval
pub fn parse_interval(s: string): Duration throws PolarsError
parse_interval
pub fn parse_interval(s: string): Duration throws PolarsError
add_ms
pub fn add_ms(self, t: int) throws PolarsError
add_ms
pub fn add_ms(self, t: int) throws PolarsError
add_ns
pub fn add_ns(self, t: int) throws PolarsError
add_ns
pub fn add_ns(self, t: int) throws PolarsError
add_us
pub fn add_us(self, t: int) throws PolarsError
add_us
pub fn add_us(self, t: int) throws PolarsError
is_constant_duration
pub fn is_constant_duration(self, tz: string? = nil): bool
is_constant_duration
pub fn is_constant_duration(self, tz: string? = nil): bool
is_full_days
pub fn is_full_days(self): bool
Returns whether the duration consists of full days.
is_full_days
pub fn is_full_days(self): bool
Returns whether the duration consists of full days.
Returns whether the duration consists of full days.
Note that 24 hours is not considered a full day due to possible daylight savings time transitions.
Returns true
if the duration is zero.
Returns true
if the duration is zero.
Returns true
if the duration is zero.
months_only
pub fn months_only(self): bool
months_only
pub fn months_only(self): bool
nanoseconds
pub fn nanoseconds(self): int
Returns the nanoseconds from the Duration
without the weeks or months part.
nanoseconds
pub fn nanoseconds(self): int
Returns the nanoseconds from the Duration
without the weeks or months part.
Returns the nanoseconds from the Duration
without the weeks or months part.
Returns whether duration is negative.
Returns whether duration is negative.
Returns whether duration is negative.
truncate_ms
pub fn truncate_ms(self, t: int) throws PolarsError
truncate_ms
pub fn truncate_ms(self, t: int) throws PolarsError
truncate_ns
pub fn truncate_ns(self, t: int) throws PolarsError
truncate_ns
pub fn truncate_ns(self, t: int) throws PolarsError
truncate_us
pub fn truncate_us(self, t: int) throws PolarsError
truncate_us
pub fn truncate_us(self, t: int) throws PolarsError
weeks_only
pub fn weeks_only(self): bool
weeks_only
pub fn weeks_only(self): bool