pandas.arrays.IntegerArray — pandas 3.0.0.dev0+2098.g9c5b9ee823 documentation (original) (raw)

class pandas.arrays.IntegerArray(values, mask, copy=False)[source]#

Array of integer (optional missing) values.

Uses pandas.NA as the missing value.

Warning

IntegerArray is currently experimental, and its API or internal implementation may change without warning.

We represent an IntegerArray with 2 numpy arrays:

To construct an IntegerArray from generic array-like input, usepandas.array() with one of the integer dtypes (see examples).

See Nullable integer data type for more.

Parameters:

valuesnumpy.ndarray

A 1-d integer-dtype array.

masknumpy.ndarray

A 1-d boolean-dtype array indicating missing values.

copybool, default False

Whether to copy the values and mask.

Attributes

Methods

Returns:

IntegerArray

See also

array

Create an array using the appropriate dtype, including IntegerArray.

Int32Dtype

An ExtensionDtype for int32 integer data.

UInt16Dtype

An ExtensionDtype for uint16 integer data.

Examples

Create an IntegerArray with pandas.array().

int_array = pd.array([1, None, 3], dtype=pd.Int32Dtype()) int_array [1, , 3] Length: 3, dtype: Int32

String aliases for the dtypes are also available. They are capitalized.

pd.array([1, None, 3], dtype="Int32") [1, , 3] Length: 3, dtype: Int32

pd.array([1, None, 3], dtype="UInt16") [1, , 3] Length: 3, dtype: UInt16