pyarrow.day_time_interval#

pyarrow.day_time_interval()#

Create instance of an interval type representing day and milliseconds between two dates.

Examples

Create an instance of a day_time_interval type:

>>> import pyarrow as pa
>>> pa.day_time_interval()
DataType(day_time_interval)

The type can’t be created from Python values yet, but compute functions return it:

>>> import pyarrow.compute as pc
>>> import datetime
>>> arr1 = pa.array([datetime.datetime(2020, 1, 1)], type=pa.timestamp('s'))
>>> arr2 = pa.array([datetime.datetime(2020, 5, 5)], type=pa.timestamp('s'))

Create an array with day_time_interval type:

>>> pc.day_time_interval_between(arr1, arr2)
<pyarrow.lib.DayTimeIntervalArray object at ...>
[
  125d0ms
]

or select a scalar with the same type:

>>> pc.day_time_interval_between(arr1, arr2)[0]
<pyarrow.DayTimeIntervalScalar: DayTime(days=125, milliseconds=0)>