NestedExtensionArray#
- class NestedExtensionArray(values: Array | ChunkedArray, *, validate: bool = True)[source]#
Pandas extension array for nested dataframes
- Parameters:
values (pyarrow.Array or pyarrow.ChunkedArray) – The array to be wrapped, must be a struct array with all fields being list arrays of the same lengths.
validate (bool, default True) – Whether to validate the input array.
- Raises:
ValueError – If the input array is not a struct array or if any of the fields is not a list array or if the list arrays have different lengths.
Methods
__init__(values, *[, validate])argmax([skipna])Return the index of maximum value.
argmin([skipna])Return the index of minimum value.
argsort(*[, ascending, kind, na_position])Return the indices that would sort this array.
astype(dtype[, copy])Cast to a NumPy array or ExtensionArray with 'dtype'.
copy()Return a copy of the extension array.
delete(loc)dropna()Return a new ExtensionArray with missing values removed.
duplicated([keep])Return boolean ndarray denoting duplicate values.
equals(other)Check equality with another NestedExtensionArray.
factorize([use_na_sentinel])Encode the extension array as an enumerated type.
fill_field_lists(field, value, *[, keep_dtype])Fill list-arrays with values from the input array
fillna([value, method, limit, copy])Fill NA/NaN values using the specified method.
from_arrow_ext_array(array)Create a NestedExtensionArray from pandas' ArrowExtensionArray
from_sequence(scalars, *[, dtype])Construct a NestedExtensionArray from a sequence of items
Keys mapping values to lists
insert(loc, item)Insert an item at the given position.
interpolate(*, method, axis, index, limit, ...)Interpolate missing values, not implemented yet.
is_input_pa_type_supported(pa_type)Check whether a pyarrow data type is supported by the constructor.
isin(values)Pointwise comparison for set containment in the given values.
isna()Boolean NumPy array indicating if each value is missing.
iter_field_lists(field)Iterate over single field nested lists, as numpy arrays
map(mapper[, na_action])Map values using an input mapping or function.
pop_fields(fields)Delete fields from the struct array
ravel([order])Return a flattened view on this array.
repeat(repeats[, axis])Repeat elements of a ExtensionArray.
searchsorted(value[, side, sorter])Find indices where elements should be inserted to maintain order.
set_flat_field(field, value, *[, keep_dtype])Set the field from flat-array of values
set_list_field(field, value, *[, keep_dtype])Set the field from list-array
shift([periods, fill_value])Shift values by desired number.
take(indices, *[, allow_fill, fill_value])Take elements from an array.
to_arrow_ext_array([list_struct, large_list])Convert the extension array to pandas' ArrowExtensionArray
to_numpy(dtype, ...)Convert the extension array to a numpy array.
to_pyarrow_scalar([list_struct, large_list])Convert to a pyarrow scalar of a list type
tolist()Return a list of the values.
transpose(*axes)Return a transposed view on this array.
unique()Compute the ExtensionArray of unique values.
view([dtype])Return a view on the array.
view_fields(fields)Get a view of the extension array with the specified fields only
Attributes
TExtensionArray dtype
Names of the nested columns
Length of the flat arrays
Pyarrow chunked list-struct array representation
Lengths of the list arrays
The list offsets of the field arrays.
Number of bytes consumed by the data in memory.
ndimExtension Arrays are only allowed to be 1-dimensional.
Number of chunk_lens in underlying pyarrow.ChunkedArray
Pyarrow table representation of the extension array.
shapeReturn a tuple of the array dimensions.
sizeThe number of elements in the array.
Pyarrow chunked struct-list array representation