>>> import ibis
>>> ibis.options.interactive = True
>>> lower = ibis.date(2024, 12, 30)
>>> upper = ibis.date(2025, 1, 1)
>>> ibis.date(2024, 12, 31).between(lower, upper)โโโโโโโโ
โ True โ
โโโโโโโโ
Dates, times, timestamps and intervals.
A date and time, eg 2024-12-31 23:59:59.999999.
| 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. |
| day_of_week | A namespace of methods for extracting day of week information. |
| Name | Description |
|---|---|
| between | Check if the expr falls between lower and upper, inclusive. |
| bucket | Truncate the timestamp to buckets of a specified interval. |
| date | Return the date component of the expression. |
| day | Extract the day component. |
| day_of_year | Extract the day of the year component. |
| delta | Compute the number of parts between two timestamps. |
| epoch_seconds | Extract UNIX epoch in seconds. |
| hour | Extract the hour component. |
| microsecond | Extract the microsecond component. |
| millisecond | Extract the millisecond component. |
| minute | Extract the minute component. |
| month | Extract the month component. |
| quarter | Extract the quarter component. |
| second | Extract the second component. |
| strftime | Format a timestamp according to format_str. |
| time | Return the time component of the expression. |
| truncate | Truncate timestamp expression to units of unit. |
| week_of_year | Extract the week of the year component. |
| year | Extract the year component. |
Check if the expr falls between lower and upper, inclusive.
Adjusts according to timezone if provided.
| Name | Type | Description | Default |
|---|---|---|---|
| lower | str | datetime.time | TimeValue | Lower bound | required |
| upper | str | datetime.time | TimeValue | Upper bound | required |
| timezone | str | None | Time zone | None |
| Name | Type | Description |
|---|---|---|
| BooleanValue | Whether self is between lower and upper, adjusting timezone as needed. |
โโโโโโโโ
โ True โ
โโโโโโโโ
Truncate the timestamp to buckets of a specified interval.
This is similar to truncate, but supports truncating to arbitrary intervals rather than a single unit. Buckets are computed as fixed intervals starting from the UNIX epoch. This origin may be offset by specifying offset.
| Name | Type | Description | Default |
|---|---|---|---|
| interval | Any | The bucket width as an interval. Alternatively may be specified via component keyword arguments. | None |
| 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 |
| offset | Any | An interval to use to offset the start of the bucket. | None |
| Name | Type | Description |
|---|---|---|
| TimestampValue | The start of the bucket as a timestamp. |
Bucket the data into 5 minute wide buckets:
โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ TimestampBucket(ts, 5m) โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ timestamp โ โโโโโโโโโโโโโโโโโโโโโโโโโโโค โ 2020-04-15 08:00:00 โ โ 2020-04-15 08:05:00 โ โ 2020-04-15 08:05:00 โ โ 2020-04-15 08:10:00 โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
Bucket the data into 5 minute wide buckets, offset by 2 minutes:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ TimestampBucket(ts, 5m, 2m) โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ timestamp โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ 2020-04-15 08:02:00 โ โ 2020-04-15 08:02:00 โ โ 2020-04-15 08:07:00 โ โ 2020-04-15 08:07:00 โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
One common use of timestamp bucketing is computing statistics per bucket. Here we compute the mean of val across 5 minute intervals:
โโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโ โ bucket โ mean โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ timestamp โ float64 โ โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโค โ 2020-04-15 08:00:00 โ 1.0 โ โ 2020-04-15 08:05:00 โ 2.5 โ โ 2020-04-15 08:10:00 โ 4.0 โ โโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโ
Return the date component of the expression.
| Name | Type | Description |
|---|---|---|
| DateValue | The date component of self |
Extract the day component.
Extract the day of the year component.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ ExtractDayOfYear(date_col) โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ int32 โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ 1 โ โ 168 โ โ 365 โ โ 60 โ โ 366 โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Compute the number of parts between two timestamps.
The second argument is subtracted from the first.
| Name | Type | Description | Default |
|---|---|---|---|
| other | datetime.datetime | Value[dt.Timestamp] |
A timestamp expression | required |
| unit | Literal['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', 'millisecond', 'microsecond', 'nanosecond'] | Value[dt.String] |
The unit of time to compute the difference in | required |
| Name | Type | Description |
|---|---|---|
| IntegerValue | The number of parts between self and other |
โโโโโโ
โ 22 โ
โโโโโโ
>>> data = '''tpep_pickup_datetime,tpep_dropoff_datetime
... 2016-02-01T00:23:56,2016-02-01T00:42:28
... 2016-02-01T00:12:14,2016-02-01T00:21:41
... 2016-02-01T00:43:24,2016-02-01T00:46:14
... 2016-02-01T00:55:11,2016-02-01T01:24:34
... 2016-02-01T00:11:13,2016-02-01T00:16:59'''
>>> with open("/tmp/triptimes.csv", "w") as f:
... nbytes = f.write(data) # nbytes is unused
>>> taxi = ibis.read_csv("/tmp/triptimes.csv")
>>> ride_duration = taxi.tpep_dropoff_datetime.delta(
... taxi.tpep_pickup_datetime, unit="minute"
... ).name("ride_minutes")
>>> ride_durationโโโโโโโโโโโโโโโโ โ ride_minutes โ โกโโโโโโโโโโโโโโโฉ โ int64 โ โโโโโโโโโโโโโโโโค โ 19 โ โ 9 โ โ 3 โ โ 29 โ โ 5 โ โโโโโโโโโโโโโโโโ
Extract UNIX epoch in seconds.
Extract the hour component.
Extract the microsecond component.
Extract the millisecond component.
Extract the minute component.
Extract the month component.
Extract the quarter component.
Extract the second component.
Format a timestamp according to format_str.
Format string may depend on the backend, but we try to conform to ANSI strftime.
| Name | Type | Description | Default |
|---|---|---|---|
| format_str | str | strftime format string |
required |
| Name | Type | Description |
|---|---|---|
| StringValue | Formatted version of arg |
Return a string with the year and month.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Strftime(timestamp_col, '%Y-%m') โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ string โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ 2020-10 โ โ 2020-11 โ โ 2020-12 โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Return a string with the month, day, and year.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Strftime(timestamp_col, '%B %-d, %Y') โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ string โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ October 5, 2020 โ โ November 10, 2020 โ โ December 15, 2020 โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Return a string with the month, day, year, hour, minute, and AM/PM.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Strftime(timestamp_col, '%B %-d, %Y at %I:%M %p') โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ string โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ October 5, 2020 at 08:00 AM โ โ November 10, 2020 at 10:02 AM โ โ December 15, 2020 at 12:04 PM โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Return the time component of the expression.
| Name | Type | Description |
|---|---|---|
| TimeValue | The time component of self |
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 |
| Name | Type | Description |
|---|---|---|
| TimestampValue | Truncated timestamp expression |
>>> from datetime import datetime
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable(
... {
... "timestamp_col": [
... datetime(2020, 1, 5, 8, 0, 0),
... datetime(2020, 4, 10, 10, 2, 15),
... datetime(2020, 7, 15, 12, 4, 30),
... datetime(2020, 10, 20, 14, 6, 45),
... ]
... },
... )Return timestamp columns truncated to the start of the year, quarter, and month.
โโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโ โ year โ quarter โ month โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ timestamp โ timestamp โ timestamp โ โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโค โ 2020-01-01 00:00:00 โ 2020-01-01 00:00:00 โ 2020-01-01 00:00:00 โ โ 2020-01-01 00:00:00 โ 2020-04-01 00:00:00 โ 2020-04-01 00:00:00 โ โ 2020-01-01 00:00:00 โ 2020-07-01 00:00:00 โ 2020-07-01 00:00:00 โ โ 2020-01-01 00:00:00 โ 2020-10-01 00:00:00 โ 2020-10-01 00:00:00 โ โโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโ
Return timestamp columns truncated to the start of the week and day.
โโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโ โ week โ day โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ timestamp โ timestamp โ โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโค โ 2019-12-30 00:00:00 โ 2020-01-05 00:00:00 โ โ 2020-04-06 00:00:00 โ 2020-04-10 00:00:00 โ โ 2020-07-13 00:00:00 โ 2020-07-15 00:00:00 โ โ 2020-10-19 00:00:00 โ 2020-10-20 00:00:00 โ โโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโ
Return timestamp columns truncated to the start of the hour, minute, and second.
โโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโ โ hour โ minute โ second โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ timestamp โ timestamp โ timestamp โ โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโค โ 2020-01-05 08:00:00 โ 2020-01-05 08:00:00 โ 2020-01-05 08:00:00 โ โ 2020-04-10 10:00:00 โ 2020-04-10 10:02:00 โ 2020-04-10 10:02:15 โ โ 2020-07-15 12:00:00 โ 2020-07-15 12:04:00 โ 2020-07-15 12:04:30 โ โ 2020-10-20 14:00:00 โ 2020-10-20 14:06:00 โ 2020-10-20 14:06:45 โ โโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโ
Extract the week of the year component.
Extract the year component.
A date (without time), eg 2024-12-31.
| 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. |
| day_of_week | A namespace of methods for extracting day of week information. |
| Name | Description |
|---|---|
| day | Extract the day component. |
| day_of_year | Extract the day of the year component. |
| epoch_seconds | Extract UNIX epoch in seconds. |
| month | Extract the month component. |
| quarter | Extract the quarter component. |
| strftime | Format a date according to format_str. |
| truncate | Truncate date expression to units of unit. |
| week_of_year | Extract the week of the year component. |
| year | Extract the year component. |
Extract the day component.
Extract the day of the year component.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ ExtractDayOfYear(date_col) โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ int32 โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ 1 โ โ 168 โ โ 365 โ โ 60 โ โ 366 โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Extract UNIX epoch in seconds.
Extract the month component.
Extract the quarter component.
Format a date according to format_str.
Format string may depend on the backend, but we try to conform to ANSI strftime.
| Name | Type | Description | Default |
|---|---|---|---|
| format_str | str | strftime format string |
required |
| Name | Type | Description |
|---|---|---|
| StringValue | Formatted version of arg |
Return a string with the year and month.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Strftime(date_col, '%Y-%m') โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ string โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ 2020-10 โ โ 2020-11 โ โ 2020-12 โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Return a string with the month name, day, and year.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Strftime(date_col, '%B %-d, %Y') โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ string โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ October 5, 2020 โ โ November 10, 2020 โ โ December 15, 2020 โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Truncate date expression to units of unit.
| Name | Type | Description | Default |
|---|---|---|---|
| unit | Literal['Y', 'Q', 'M', 'W', 'D'] | Unit to truncate arg to |
required |
| Name | Type | Description |
|---|---|---|
| DateValue | Truncated date value expression |
Return date columns truncated to the start of the year, quarter, month, and week.
โโโโโโโโโโโโโโณโโโโโโโโโโโโโณโโโโโโโโโโโโโณโโโโโโโโโโโโโ โ year โ quarter โ month โ week โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ date โ date โ date โ date โ โโโโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโโโค โ 2020-01-01 โ 2020-01-01 โ 2020-01-01 โ 2019-12-30 โ โ 2020-01-01 โ 2020-04-01 โ 2020-04-01 โ 2020-04-06 โ โ 2020-01-01 โ 2020-07-01 โ 2020-07-01 โ 2020-07-13 โ โ 2020-01-01 โ 2020-10-01 โ 2020-10-01 โ 2020-10-19 โ โโโโโโโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโโโโโโโ
Extract the week of the year component.
Extract the year component.
A time of day from 0:00:00 to 23:59:59.999999999.
| 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 |
|---|---|
| between | Check if the expr falls between lower and upper, inclusive. |
| hour | Extract the hour component. |
| microsecond | Extract the microsecond component. |
| millisecond | Extract the millisecond component. |
| minute | Extract the minute component. |
| second | Extract the second component. |
| strftime | Format a time according to format_str. |
| time | Return the time component of the expression. |
| truncate | Truncate the expression to a time expression in units of unit. |
Check if the expr falls between lower and upper, inclusive.
Adjusts according to timezone if provided.
| Name | Type | Description | Default |
|---|---|---|---|
| lower | str | datetime.time | TimeValue | Lower bound | required |
| upper | str | datetime.time | TimeValue | Upper bound | required |
| timezone | str | None | Time zone | None |
| Name | Type | Description |
|---|---|---|
| BooleanValue | Whether self is between lower and upper, adjusting timezone as needed. |
โโโโโโโโ
โ True โ
โโโโโโโโ
Extract the hour component.
Extract the microsecond component.
Extract the millisecond component.
Extract the minute component.
Extract the second component.
Format a time according to format_str.
Format string may depend on the backend, but we try to conform to ANSI strftime.
| Name | Type | Description | Default |
|---|---|---|---|
| format_str | str | strftime format string |
required |
| Name | Type | Description |
|---|---|---|
| StringValue | Formatted version of arg |
Return the time component of the expression.
| Name | Type | Description |
|---|---|---|
| TimeValue | The time component of self |
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 |
| Name | Type | Description |
|---|---|---|
| TimeValue | self truncated to unit |
A time duration, eg 6 day or 2 hours or 457 seconds.
This is the result from operations that compute the difference between two date or timestamp expressions, such as Timestamp.delta().
This can be combined with date or timestamp expressions using addition and subtraction, eg ibis.timestamp("2020-01-01") + ibis.interval(days=1), which results in a new timestamp expression.
| Name | Description |
|---|---|
| years | The number of years (IntegerValue). |
| quarters | The number of quarters (IntegerValue). |
| months | The number of months (IntegerValue). |
| weeks | The number of weeks (IntegerValue). |
| days | The number of days (IntegerValue). |
| hours | The number of hours (IntegerValue). |
| minutes | The number of minutes (IntegerValue). |
| seconds | The number of seconds (IntegerValue). |
| milliseconds | The number of milliseconds (IntegerValue). |
| microseconds | The number of microseconds (IntegerValue). |
| nanoseconds | The number of nanoseconds (IntegerValue). |
| Name | Description |
|---|---|
| to_unit | ::: {.callout-warning} |
| negate | Negate an interval expression. |
IntervalValue.to_unit is deprecated as of v10.0; use as_unit() instead
Negate an interval expression.
| Name | Type | Description |
|---|---|---|
| IntervalValue | A negated interval value expression |
Negate a positive interval of one day to subtract a day from a specific date.
โโโโโโโโโโโโโโ
โ 2024-10-31 โ
โโโโโโโโโโโโโโ
Negate a negative interval of one day to add a day to a specific date.
A namespace of methods for days of the week, eg โMondayโ or โTuesdayโ.
| Name | Description |
|---|---|
| full_name | Get the name of the day of the week, eg โMondayโ or โTuesdayโ. |
| index | Get the index of the day of the week. |
Get the name of the day of the week, eg โMondayโ or โTuesdayโ.
| Name | Type | Description |
|---|---|---|
| StringValue | The name of the day of the week |
>>> from datetime import date
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable(
... {
... "date_col": [
... date(2024, 10, 27),
... date(2024, 10, 28),
... date(2024, 10, 29),
... date(2024, 10, 30),
... date(2024, 10, 31),
... date(2024, 11, 1),
... date(2024, 11, 2),
... ]
... },
... )
>>> t.date_col.day_of_week.full_name()โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ DayOfWeekName(date_col) โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ string โ โโโโโโโโโโโโโโโโโโโโโโโโโโโค โ Sunday โ โ Monday โ โ Tuesday โ โ Wednesday โ โ Thursday โ โ Friday โ โ Saturday โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ
Get the index of the day of the week.
pandas convention for day numbering: Monday = 0 and Sunday = 6.
| Name | Type | Description |
|---|---|---|
| IntegerValue | The index of the day of the week. |
>>> from datetime import date
>>> import ibis
>>> ibis.options.interactive = True
>>> t = ibis.memtable(
... {
... "date_col": [
... date(2024, 10, 27),
... date(2024, 10, 28),
... date(2024, 10, 29),
... date(2024, 10, 30),
... date(2024, 10, 31),
... date(2024, 11, 1),
... date(2024, 11, 2),
... ]
... },
... )
>>> t.date_col.day_of_week.index()โโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ DayOfWeekIndex(date_col) โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ int16 โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ 6 โ โ 0 โ โ 1 โ โ 2 โ โ 3 โ โ 4 โ โ 5 โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Return an expression that will compute the current timestamp.
| Name | Type | Description |
|---|---|---|
TimestampScalar |
An expression representing the current timestamp. |
Return an expression that will compute the current date.
| Name | Type | Description |
|---|---|---|
DateScalar |
An expression representing the current date. |
Construct a date scalar or column.
| Name | Type | Description | Default |
|---|---|---|---|
| value_or_year | Either a string value or datetime.date to coerce to a date, or an integral value representing the date year component. |
required | |
| month | The date month component; required if value_or_year is a year. |
None |
|
| day | The date day component; required if value_or_year is a year. |
None |
| Name | Type | Description |
|---|---|---|
DateValue |
A date expression |
Create a date scalar from a string
โโโโโโโโโโโโโโ
โ 2023-01-02 โ
โโโโโโโโโโโโโโ
Create a date scalar from year, month, and day
โโโโโโโโโโโโโโ
โ 2023-01-02 โ
โโโโโโโโโโโโโโ
Create a date column from year, month, and day
โโโโโโโโโโโโโโ โ my_date โ โกโโโโโโโโโโโโโฉ โ date โ โโโโโโโโโโโโโโค โ 2001-01-02 โ โ 2002-03-04 โ โโโโโโโโโโโโโโ
Return a time literal if value is coercible to a time.
| Name | Type | Description | Default |
|---|---|---|---|
| value_or_hour | Either a string value or datetime.time to coerce to a time, or an integral value representing the time hour component. |
required | |
| minute | The time minute component; required if value_or_hour is an hour. |
None |
|
| second | The time second component; required if value_or_hour is an hour. |
None |
| Name | Type | Description |
|---|---|---|
TimeValue |
A time expression |
Create a time scalar from a string
โโโโโโโโโโโโ
โ 01:02:03 โ
โโโโโโโโโโโโ
Create a time scalar from hour, minute, and second
โโโโโโโโโโโโ
โ 01:02:03 โ
โโโโโโโโโโโโ
Create a time column from hour, minute, and second
โโโโโโโโโโโโ โ time โ โกโโโโโโโโโโโฉ โ time โ โโโโโโโโโโโโค โ 01:02:03 โ โ 04:05:06 โ โโโโโโโโโโโโ
Construct a timestamp scalar or column.
| Name | Type | Description | Default |
|---|---|---|---|
| value_or_year | Either a string value or datetime.datetime to coerce to a timestamp, or an integral value representing the timestamp year component. |
required | |
| month | The timestamp month component; required if value_or_year is a year. |
None |
|
| day | The timestamp day component; required if value_or_year is a year. |
None |
|
| hour | The timestamp hour component; required if value_or_year is a year. |
None |
|
| minute | The timestamp minute component; required if value_or_year is a year. |
None |
|
| second | The timestamp second component; required if value_or_year is a year. |
None |
|
| timezone | The timezone name, or none for a timezone-naive timestamp. | None |
| Name | Type | Description |
|---|---|---|
TimestampValue |
A timestamp expression |
Create a timestamp scalar from a string
โโโโโโโโโโโโโโโโโโโโโโโ
โ 2023-01-02 03:04:05 โ
โโโโโโโโโโโโโโโโโโโโโโโ
Create a timestamp scalar from components
โโโโโโโโโโโโโโโโโโโโโโโ
โ 2023-01-02 03:04:05 โ
โโโโโโโโโโโโโโโโโโโโโโโ
Create a timestamp column from components
โโโโโโโโโโโโโโโโโโโโโโโ โ timestamp โ โกโโโโโโโโโโโโโโโโโโโโโโฉ โ timestamp โ โโโโโโโโโโโโโโโโโโโโโโโค โ 2001-01-02 03:00:00 โ โ 2002-04-05 06:00:00 โ โโโโโโโโโโโโโโโโโโโโโโโ
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 |
| Name | Type | Description |
|---|---|---|
IntervalScalar |
An interval expression |
Add and subtract ten days from a timestamp column.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MonthDayNano(months=0, days=10, nanoseconds=0) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโ โ timestamp_col โ plus_ten_days โ minus_ten_days โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ timestamp โ timestamp โ timestamp โ โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโค โ 2020-10-05 08:00:00 โ 2020-10-15 08:00:00 โ 2020-09-25 08:00:00 โ โ 2020-11-10 10:02:15 โ 2020-11-20 10:02:15 โ 2020-10-31 10:02:15 โ โ 2020-12-15 12:04:30 โ 2020-12-25 12:04:30 โ 2020-12-05 12:04:30 โ โโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโ
Intervals provide more granularity with date arithmetic.
โโโโโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโโโโโโโโโโโโ โ timestamp_col โ added_interval โ โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ โ timestamp โ timestamp โ โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโค โ 2020-10-05 08:00:00 โ 2020-10-14 11:04:05 โ โ 2020-11-10 10:02:15 โ 2020-11-19 13:06:20 โ โ 2020-12-15 12:04:30 โ 2020-12-24 15:08:35 โ โโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโ