pyarrow.IntegerArray

class pyarrow.IntegerArray

Bases: pyarrow.lib.NumericArray

__init__()

Initialize self. See help(type(self)) for accurate signature.

Methods

equals(self, Array other)
from_pandas(obj[, mask, timestamps_to_ms]) Convert pandas.Series to an Arrow Array.
isnull(self)
slice(self[, offset, length]) Compute zero-copy slice of this array
to_pandas(self) Convert to an array object suitable for use in pandas
to_pylist(self) Convert to an list of native Python objects.

Attributes

null_count
type
equals(self, Array other)
from_pandas(obj, mask=None, DataType type=None, timestamps_to_ms=False, MemoryPool memory_pool=None)

Convert pandas.Series to an Arrow Array.

Parameters:
  • series (pandas.Series or numpy.ndarray) –
  • mask (pandas.Series or numpy.ndarray, optional) – boolean mask if the object is null (True) or valid (False)
  • type (pyarrow.DataType) – Explicit type to attempt to coerce to
  • timestamps_to_ms (bool, optional) – Convert datetime columns to ms resolution. This is needed for compatibility with other functionality like Parquet I/O which only supports milliseconds.
  • memory_pool (MemoryPool, optional) – Specific memory pool to use to allocate the resulting Arrow array.

Notes

Localized timestamps will currently be returned as UTC (pandas’s native representation). Timezone-naive data will be implicitly interpreted as UTC.

Examples

>>> import pandas as pd
>>> import pyarrow as pa
>>> pa.Array.from_pandas(pd.Series([1, 2]))
<pyarrow.array.Int64Array object at 0x7f674e4c0e10>
[
  1,
  2
]
>>> import numpy as np
>>> pa.Array.from_pandas(pd.Series([1, 2]), np.array([0, 1],
... dtype=bool))
<pyarrow.array.Int64Array object at 0x7f9019e11208>
[
  1,
  NA
]
Returns:pyarrow.array.Array
isnull(self)
null_count
slice(self, offset=0, length=None)

Compute zero-copy slice of this array

Parameters:
  • offset (int, default 0) – Offset from start of array to slice
  • length (int, default None) – Length of slice (default is until end of Array starting from offset)
Returns:

sliced (RecordBatch)

to_pandas(self)

Convert to an array object suitable for use in pandas

to_pylist(self)

Convert to an list of native Python objects.

type