>>> import ibis
>>> ibis.options.interactive = True
>>> ibis.time("00:00:00")
datetime.time(0, 0)
Dates, times, timestamps and intervals.
expr.types.temporal.TimestampValue()
Name | Description |
---|---|
add | Add an interval to a timestamp. |
radd | Add an interval to a timestamp. |
sub | Subtract a timestamp or an interval from a timestamp. |
Name | Description |
---|---|
date | Return the date component of the expression. |
truncate | Truncate timestamp expression to units of unit . |
date(self)
Return the date component of the expression.
Type | Description |
---|---|
DateValue | The date component of self |
truncate(self, unit)
Truncate timestamp expression to units of unit
.
Name | Type | Description | Default |
---|---|---|---|
unit |
Literal[‘Y’, ‘Q’, ‘M’, ‘W’, ‘D’, ‘h’, ‘m’, ‘s’, ‘ms’, ‘us’, ‘ns’] | Unit to truncate to | required |
Type | Description |
---|---|
TimestampValue | Truncated timestamp expression |
expr.types.temporal.DateValue()
Name | Description |
---|---|
add | Add an interval to a date. |
radd | Add an interval to a date. |
sub | Subtract a date or an interval from a date. |
Name | Description |
---|---|
truncate | Truncate date expression to units of unit . |
truncate(self, unit)
Truncate date expression to units of unit
.
Name | Type | Description | Default |
---|---|---|---|
unit |
Literal[‘Y’, ‘Q’, ‘M’, ‘W’, ‘D’] | Unit to truncate arg to |
required |
Type | Description |
---|---|
DateValue | Truncated date value expression |
expr.types.temporal.TimeValue()
Name | Description |
---|---|
add | Add an interval to a time expression. |
radd | Add an interval to a time expression. |
sub | Subtract a time or an interval from a time expression. |
Name | Description |
---|---|
truncate | Truncate the expression to a time expression in units of unit . |
truncate(self, unit)
Truncate the expression to a time expression in units of unit
.
Commonly used for time series resampling.
Name | Type | Description | Default |
---|---|---|---|
unit |
Literal[‘h’, ‘m’, ‘s’, ‘ms’, ‘us’, ‘ns’] | The unit to truncate to | required |
Type | Description |
---|---|
TimeValue | self truncated to unit |
expr.types.temporal.IntervalValue()
Name | Description |
---|---|
days | Extract the number of days from an interval. |
hours | Extract the number of hours from an interval. |
microseconds | Extract the number of microseconds from an interval. |
milliseconds | Extract the number of milliseconds from an interval. |
minutes | Extract the number of minutes from an interval. |
months | Extract the number of months from an interval. |
nanoseconds | Extract the number of nanoseconds from an interval. |
quarters | Extract the number of quarters from an interval. |
seconds | Extract the number of seconds from an interval. |
weeks | Extract the number of weeks from an interval. |
years | Extract the number of years from an interval. |
Name | Description |
---|---|
negate | Negate an interval expression. |
to_unit | Convert this interval to units of target_unit . |
negate(self)
Negate an interval expression.
Type | Description |
---|---|
IntervalValue | A negated interval value expression |
to_unit(self, target_unit)
Convert this interval to units of target_unit
.
expr.types.temporal.DayOfWeek(self, expr)
A namespace of methods for extracting day of week information.
Name | Description |
---|---|
full_name | Get the name of the day of the week. |
index | Get the index of the day of the week. |
full_name(self)
Get the name of the day of the week.
Type | Description |
---|---|
StringValue | The name of the day of the week |
index(self)
Get the index of the day of the week.
pandas
convention for day numbering: Monday = 0 and Sunday = 6.
Type | Description |
---|---|
IntegerValue | The index of the day of the week. |
now()
Return an expression that will compute the current timestamp.
Type | Description |
---|---|
TimestampScalar | An expression representing the current timestamp. |
date(value, *args)
Return a date literal if value
is coercible to a date.
Name | Type | Description | Default |
---|---|---|---|
value |
Date string, datetime object or numeric value | required | |
args |
Month and day if value is a year |
() |
Type | Description |
---|---|
DateScalar | A date expression |
time(value, *args)
Return a time literal if value
is coercible to a time.
Name | Type | Description | Default |
---|---|---|---|
value |
Time string | required | |
args |
Minutes, seconds if value is an hour |
() |
Type | Description |
---|---|
TimeScalar | A time expression |
timestamp(value, *args, timezone=None)
Return a timestamp literal if value
is coercible to a timestamp.
Name | Type | Description | Default |
---|---|---|---|
value |
Timestamp string, datetime object or numeric value | required | |
args |
Additional arguments if value is numeric |
() |
|
timezone |
str | None | Timezone name | None |
Type | Description |
---|---|
TimestampScalar | A timestamp expression |
interval(value=None, unit='s', *, years=None, quarters=None, months=None, weeks=None, days=None, hours=None, minutes=None, seconds=None, milliseconds=None, microseconds=None, nanoseconds=None)
Return an interval literal expression.
Name | Type | Description | Default |
---|---|---|---|
value |
int | datetime.timedelta | None | Interval value. | None |
unit |
str | Unit of value |
's' |
years |
int | None | Number of years | None |
quarters |
int | None | Number of quarters | None |
months |
int | None | Number of months | None |
weeks |
int | None | Number of weeks | None |
days |
int | None | Number of days | None |
hours |
int | None | Number of hours | None |
minutes |
int | None | Number of minutes | None |
seconds |
int | None | Number of seconds | None |
milliseconds |
int | None | Number of milliseconds | None |
microseconds |
int | None | Number of microseconds | None |
nanoseconds |
int | None | Number of nanoseconds | None |
Type | Description |
---|---|
IntervalScalar | An interval expression |