Skip to content

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

unit Unit to truncate arg to

Returns

DateValue Truncated date value expression

DayOfWeek (Expr)

Methods
full_name(self)

Get the name of the day of the week.

Returns

StringValue The name of the day of the week

index(self)

Get the index of the day of the week.

Returns

IntegerValue The index of the day of the week.

!!! note "Ibis follows pandas' conventions for day numbers: Monday = 0 and Sunday = 6."

IntervalValue (Value)

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

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 (Value)

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

format_str strftime format string

Returns

StringValue Formatted version of arg

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

unit The unit to truncate to

Returns

TimeValue self truncated to unit

TimestampValue (_DateComponentMixin, _TimeComponentMixin, TemporalValue)

Methods
add(self, other)

Add an interval to a timestamp.

date(self)

Return the date component of the expression.

Returns

DateValue The date component of self

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

unit Unit to truncate to

Returns

TimestampValue Truncated timestamp expression


Last update: February 3, 2022