Beispiel #1
0
    def from_arrow(self, data):
        new_col = super().from_arrow(data.storage)
        size = len(data)
        dtype = IntervalDtype.from_arrow(data.type)
        mask = data.buffers()[0]
        if mask is not None:
            mask = cudf.utils.utils.pa_mask_buffer_to_mask(mask, len(data))

        offset = data.offset
        null_count = data.null_count
        children = new_col.children
        closed = dtype.closed

        return IntervalColumn(
            size=size,
            dtype=dtype,
            mask=mask,
            offset=offset,
            null_count=null_count,
            children=children,
            closed=closed,
        )
Beispiel #2
0
def test_interval_dtype_pyarrow_round_trip(fields, closed):
    pa_array = pd.core.arrays._arrow_utils.ArrowIntervalType(fields, closed)
    expect = pa_array
    got = IntervalDtype.from_arrow(expect).to_arrow()
    assert expect.equals(got)