This repository was archived by the owner on Apr 10, 2024. It is now read-only.
This repository was archived by the owner on Apr 10, 2024. It is now read-only.
lazy array attributes #27
Open
Description
IIRC this from the design docs, but wanted to make an issue to remember. We want to have a set of lazily computed array attributes. Sometimes these can be set at creation time based on the creation method / dtype. If the array is immutable then these are not affected by indexing checks.
immutability
/ read-only, xref block mutation of read-only array in series pandas-dev/pandas#14359unique
is_monotonic*
has_nulls
is_hashable
- only on non homogeneous dtype, usually true onobject
dtypes (but NOT if they are mutable). The issue is that this can currently be expensive to figure out (as you need to iterate over and callhash
on each element). xref
e.g. imagine a pd.date_range(....., ...)
, then unique
, monotonic
, has_nulls
are trivial to compute at creation time. Since this is currently an Index
in pandas it is immutable
by-definition.