pub struct SparseAccessor<'a> { /* private fields */ }Expand description
Accessor for sparse operations on a Series.
Created by Series::sparse(). Provides the pandas Series.sparse
namespace over the current dense-backed sparse dtype descriptor.
Implementations§
Source§impl SparseAccessor<'_>
impl SparseAccessor<'_>
Sourcepub fn value_dtype(&self) -> DType
pub fn value_dtype(&self) -> DType
Return the logical sparse value dtype.
Matches pd.Series.dtype.subtype (measured 2.2.3: float64 for a
Sparse[float64] Series).
⚠️ The path cited before, pd.Series.sparse.dtype, does not exist. The
.sparse accessor carries density/fill_value/sp_values/to_dense;
the dtype, and its subtype, hangs off the Series itself.
Sourcepub fn fill_value(&self) -> &Scalar
pub fn fill_value(&self) -> &Scalar
Return the sparse fill value.
Matches pd.Series.sparse.fill_value.
Sourcepub fn npoints(&self) -> usize
pub fn npoints(&self) -> usize
Count stored non-fill values.
Matches the SparseArray.sp_values cardinality used by pandas density.
Sourcepub fn sp_values(&self) -> Vec<Scalar>
pub fn sp_values(&self) -> Vec<Scalar>
Return the non-fill values as a Vec.
Matches pd.Series.sparse.sp_values (returns underlying non-fill data).
Sourcepub fn sp_index(&self) -> Vec<usize>
pub fn sp_index(&self) -> Vec<usize>
Return the indices of non-fill values.
Returns position indices (0-based) where values differ from fill_value.