Temporal Expression APIs¶
All timestamp operations are valid for both scalars and columns.
temporal
¶
Classes¶
DateValue (TemporalValue, _DateComponentMixin)
¶
Methods¶
add(self, other)
¶
Add an interval to a date.
radd(self, other)
¶
Add an interval to a date.
rsub(self, other)
¶
Subtract a date or an interval from a date.
sub(self, other)
¶
Subtract a date or an interval from a date.
truncate(self, unit)
¶
Truncate date expression to units of unit
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
unit |
Literal['Y', 'Q', 'M', 'W', 'D'] |
Unit to truncate |
required |
Returns:
Type | Description |
---|---|
DateValue |
Truncated date value expression |
DayOfWeek (Expr)
¶
Methods¶
full_name(self)
¶
Get the name of the day of the week.
Returns:
Type | Description |
---|---|
StringValue |
The name of the day of the week |
index(self)
¶
Get the index of the day of the week.
Returns:
Type | Description |
---|---|
IntegerValue |
The index of the day of the week. Ibis follows pandas' conventions for day numbers: Monday = 0 and Sunday = 6. |
IntervalValue (AnyValue)
¶
Attributes¶
days: ir.IntegerValue
property
readonly
¶
Extract the number of days from an interval.
hours: ir.IntegerValue
property
readonly
¶
Extract the number of hours from an interval.
microseconds: ir.IntegerValue
property
readonly
¶
Extract the number of microseconds from an interval.
milliseconds: ir.IntegerValue
property
readonly
¶
Extract the number of milliseconds from an interval.
minutes: ir.IntegerValue
property
readonly
¶
Extract the number of minutes from an interval.
months: ir.IntegerValue
property
readonly
¶
Extract the number of months from an interval.
nanoseconds: ir.IntegerValue
property
readonly
¶
Extract the number of nanoseconds from an interval.
quarters: ir.IntegerValue
property
readonly
¶
Extract the number of quarters from an interval.
seconds: ir.IntegerValue
property
readonly
¶
Extract the number of seconds from an interval.
weeks: ir.IntegerValue
property
readonly
¶
Extract the number of weeks from an interval.
years: ir.IntegerValue
property
readonly
¶
Extract the number of years from an interval.
Methods¶
add(self, other)
¶
Add this interval to other
.
floordiv(self, other)
¶
Floor-divide this interval by other
.
mul(self, other)
¶
Multiply this interval by other
.
negate(self)
¶
Negate an interval expression.
Returns:
Type | Description |
---|---|
ir.IntervalValue |
A negated interval value expression |
radd(self, other)
¶
Add this interval to other
.
rmul(self, other)
¶
Multiply this interval by other
.
rsub(self, other)
¶
Subtract other
from this interval.
sub(self, other)
¶
Subtract other
from this interval.
to_unit(self, target_unit)
¶
Convert this interval to units of target_unit
.
TemporalValue (AnyValue)
¶
Methods¶
strftime(self, format_str)
¶
Format timestamp according to format_str
.
Format string may depend on the backend, but we try to conform to ANSI
strftime
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
format_str |
str |
|
required |
Returns:
Type | Description |
---|---|
ir.StringValue |
Formatted version of |
TimeValue (_TimeComponentMixin, TemporalValue)
¶
Methods¶
add(self, other)
¶
Add an interval to a time expression.
radd(self, other)
¶
Add an interval to a time expression.
rsub(self, other)
¶
Subtract a time or an interval from a time expression.
sub(self, other)
¶
Subtract a time or an interval from a time expression.
truncate(self, unit)
¶
Truncate the expression to a time expression in units of unit
.
Commonly used for time series resampling.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
unit |
Literal['h', 'm', 's', 'ms', 'us', 'ns'] |
The unit to truncate to |
required |
Returns:
Type | Description |
---|---|
TimeValue |
|
TimestampValue (_DateComponentMixin, _TimeComponentMixin, TemporalValue)
¶
Methods¶
add(self, other)
¶
Add an interval to a timestamp.
date(self)
¶
Return the date component of the expression.
Returns:
Type | Description |
---|---|
DateValue |
The date component of |
radd(self, other)
¶
Add an interval to a timestamp.
rsub(self, other)
¶
Subtract a timestamp or an interval from a timestamp.
sub(self, other)
¶
Subtract a timestamp or an interval from a timestamp.
truncate(self, unit)
¶
Truncate timestamp expression to units of unit
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
unit |
Literal['Y', 'Q', 'M', 'W', 'D', 'h', 'm', 's', 'ms', 'us', 'ns'] |
Unit to truncate to |
required |
Returns:
Type | Description |
---|---|
TimestampValue |
Truncated timestamp expression |