A dense array of values to store in the SparseArray. This may contain :None:None:`fill_value`
.
Use a function like :None:None:`np.full`
to construct an array with the desired repeats of the scalar value instead.
Elements in data that are fill_value
are not stored in the SparseArray. For memory savings, this should be the most common value in :None:None:`data`
. By default, :None:None:`fill_value`
depends on the dtype of :None:None:`data`
:
=========== ========== data.dtype na_value =========== ========== float np.nan
int 0
bool False datetime64 pd.NaT
timedelta64 pd.NaT
=========== ==========
The fill value is potentially specified in three ways. In order of precedence, these are
Can be 'integer' or 'block', default is 'integer'. The type of storage for sparse locations.
'block': Stores a :None:None:`block`
and :None:None:`block_length`
for each contiguous span of sparse values. This is best when sparse data tends to be clumped together, with large regions of fill-value
values between sparse values.
'integer': uses an integer to store the location of each sparse value.
The dtype to use for the SparseArray. For numpy dtypes, this determines the dtype of self.sp_values
. For SparseDtype, this determines self.sp_values
and self.fill_value
.
Whether to explicitly copy the incoming :None:None:`data`
array.
An ExtensionArray for storing sparse data.
>>> from pandas.arrays import SparseArraySee :
... arr = SparseArray([0, 0, 1, 2])
... arr [0, 0, 1, 2] Fill: 0 IntIndex Indices: array([2, 3], dtype=int32)
The following pages refer to to this document either explicitly or contain code examples using this.
pandas.core.arrays.sparse.array.SparseArray
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them