pub struct Column { /* private fields */ }Implementations§
Source§impl Column
impl Column
Sourcepub fn from_object_values(values: Vec<Scalar>) -> Self
pub fn from_object_values(values: Vec<Scalar>) -> Self
A pandas object column holding values exactly as given: no coercion,
so ints stay ints and a missing value stays missing. astype(object) /
dtype=object need this; Self::new with DType::Utf8 stringifies
a homogeneous column (None became the string ‘None’;
br-frankenpandas-rc0923-epic-python-honest-dropin-fvsao.22).
Sourcepub fn new(dtype: DType, values: Vec<Scalar>) -> Result<Self, ColumnError>
pub fn new(dtype: DType, values: Vec<Scalar>) -> Result<Self, ColumnError>
Construct a column, coercing values to the target dtype.
AG-03: takes ownership of the values vec and uses cast_scalar_owned
to skip cloning when values already have the correct dtype.
pub fn from_values(values: Vec<Scalar>) -> Result<Self, ColumnError>
Sourcepub fn from_i64_values(data: Vec<i64>) -> Self
pub fn from_i64_values(data: Vec<i64>) -> Self
Build an all-valid Int64 column from already-typed contiguous values.
This carries parser/vector-kernel dtype proofs directly into the
columnar representation and delays Scalar materialization until a
caller explicitly asks for scalar values.
Sourcepub fn from_i64_arc(data: Arc<[i64]>) -> Self
pub fn from_i64_arc(data: Arc<[i64]>) -> Self
Self::from_i64_values of a buffer already in the Arc<[i64]> the
column keeps, without its Arc::from(Vec) copy - for a reader that
fills the Arc directly (a numpy array’s contiguous buffer, as
Self::from_f64_arc; the two copies were a 2-column int frame’s
build, 0.83x pandas; br-frankenpandas-qpbpa).
Sourcepub fn from_i64_constant(value: i64, len: usize) -> Self
pub fn from_i64_constant(value: i64, len: usize) -> Self
len copies of value, a broadcast number (df['z'] = 7): the column
from_i64_values makes of vec![value; len],
the copies written straight into its Arc<[i64]> - that path filled a
Vec and copied it into the Arc (br-frankenpandas-1s45z).
Sourcepub fn from_bool_constant(value: bool, len: usize) -> Self
pub fn from_bool_constant(value: bool, len: usize) -> Self
len copies of value, a broadcast bool (df['z'] = True): the column
from_bool_values makes of vec![value; len],
the copies written straight into its Arc<[bool]> - that path filled a
Vec and copied it into the Arc (br-frankenpandas-1s45z).
Sourcepub fn from_f64_constant(value: f64, len: usize) -> Self
pub fn from_f64_constant(value: f64, len: usize) -> Self
len copies of value, a broadcast number (df['z'] = 1.5): the column
from_f64_values makes of vec![value; len] -
all-valid, NaN-exact, its finite witness the number’s - without that
path’s NaN / finite scan and Vec-to-Arc copy (0.50 ms a million rows,
pandas 0.13; br-frankenpandas-1s45z). A NaN (or no rows) takes that path.
Sourcepub fn from_i64_values_owned(data: Vec<i64>) -> Self
pub fn from_i64_values_owned(data: Vec<i64>) -> Self
Like from_i64_values but MOVES the Vec<i64>
into the backing (one Arc::new) instead of Arc::from(Vec)’s
alloc+memcpy (~28ms/5M). The i64 sibling of
from_f64_values_owned; all-valid (i64
has no NaN sentinel).
Sourcepub fn timezone(&self) -> Option<&str>
pub fn timezone(&self) -> Option<&str>
Return this column’s uniform datetime timezone, if it has one.
pub fn from_f64_values(data: Vec<f64>) -> Self
Sourcepub fn from_f64_arc(data: Arc<[f64]>) -> Self
pub fn from_f64_arc(data: Arc<[f64]>) -> Self
Self::from_f64_values of a buffer already in the Arc<[f64]> that
column keeps: the same NaN-exact column without its Arc::from(Vec)
copy - for a reader that can fill the Arc directly (a numpy array’s
contiguous buffer; br-frankenpandas-br362).
Sourcepub fn from_f64_values_owned(data: Vec<f64>) -> Self
pub fn from_f64_values_owned(data: Vec<f64>) -> Self
Like from_f64_values but, for the all-valid (no-NaN) case, MOVES the
owned Vec<f64> into the backing (Arc::new, one tiny box) instead of
Arc::from(Vec)’s cold-buffer realloc-copy (~5.7ms/1M, page-fault-bound).
For op OUTPUTS that just wrote a hot Vec (cumsum/cummax/cummin/cumprod)
this is a 6-8x op-side win. Bit-identical: the single NaN scan is the same
one from_f64_values runs, and a NaN-bearing output routes to the
identical from_f64_values (NaN-as-missing) path. The resulting
LazyAllValidFloat64Vec backing is semantically identical to
LazyAllValidFloat64 (it just isn’t keyed by the Arc<f64>-specific
take_positions/binary zero-copy fast paths — fine for terminal outputs).
Sourcepub fn from_f64_values_nullable(data: Vec<f64>, validity: ValidityMask) -> Self
pub fn from_f64_values_nullable(data: Vec<f64>, validity: ValidityMask) -> Self
Build a nullable Float64 column from a raw data buffer plus an EXPLICIT
validity mask, WITHOUT re-deriving validity from NaN. The LazyNullableFloat64
backing renders each slot as: validity-set ⇒ present Float64(data);
cleared-bit-with-NaN-datum ⇒ present Float64(NaN); cleared-bit-with-
non-NaN-datum ⇒ Null(NullKind::NaN). This is the only constructor that
reproduces the per-element Scalar path’s three-way representation for typed
nullable arithmetic outputs (a GENERATED NaN must stay a present
Float64(NaN), an absent operand must be Null). Callers set the validity
bit iff the slot is present AND its datum is non-NaN.
Build an all-valid Float64 column as a ZERO-COPY WINDOW into a shared
buffer: data[start .. start + len].
Added for the transposed-frame plan, whose output has one column per
SOURCE ROW — 100_000 of them at the 100k fixture. Building each as its own
heap Column costs one allocation, one OnceLock init and one drop per
output column; profiled on df_transpose_full_materialize_positional
those three lines were ~43% of the whole lane (drop_glue 14.49%, OnceLock
machinery ~14.8%, mimalloc ~14%). A page of output columns can instead
share ONE gathered buffer, with each column a window into it.
The caller guarantees the window is all-valid and NaN-free, exactly as
Self::from_f64_all_valid_with_finite_opt requires; the window bounds
are debug-asserted by the underlying ScalarValues constructor.
Sourcepub fn from_bool_values_with_validity(
data: Vec<bool>,
validity: ValidityMask,
) -> Self
pub fn from_bool_values_with_validity( data: Vec<bool>, validity: ValidityMask, ) -> Self
Build a Bool column from already-typed contiguous values plus a
validity mask (br-frankenpandas-rcvpj). The nullable counterpart of
Column::from_bool_values: an all-valid mask folds to the contiguous
all-valid backing, otherwise invalid slots materialize
Scalar::Null(NullKind::Null) (= missing_for_dtype(Bool)), exactly
what Column::from_values over the equivalent [Bool/Null] scalars
produces — but defers the per-row Scalar boxing + dtype inference.
Used by null-bearing comparison / where / mask / isin outputs.
pub fn as_f64_slice_with_validity(&self) -> Option<(&[f64], &ValidityMask)>
Sourcepub fn as_i64_slice_with_validity(&self) -> Option<(&[i64], &ValidityMask)>
pub fn as_i64_slice_with_validity(&self) -> Option<(&[i64], &ValidityMask)>
Int64 analogue of Self::as_f64_slice_with_validity: the contiguous i64
buffer plus its validity (works for an all-valid OR a LazyNullableInt64
backing). Missingness is the validity bit alone (no NaN sentinel).
Sourcepub fn materialize_dot_columns_parallel(columns: &[&Self])
pub fn materialize_dot_columns_parallel(columns: &[&Self])
Force every pending df.dot output column in columns in ONE scope,
parallel across columns.
br-frankenpandas-1hjgz. See
ScalarValues::materialize_dot_columns_parallel for why the
parallelism is across columns rather than inside one, and why this is
bit-identical rather than a new kernel. Columns that are not dot results,
or whose result is already computed, are skipped — so calling this on an
arbitrary frame costs one pass over the column list and nothing else.
Sourcepub fn materialize_dot_columns_with_mode(columns: &[&Self], serial: bool)
pub fn materialize_dot_columns_with_mode(columns: &[&Self], serial: bool)
As Self::materialize_dot_columns_parallel, but with the serial/parallel
choice passed IN. See
ScalarValues::materialize_dot_columns_with_mode for why the
environment toggle cannot serve a test.
Sourcepub fn materialize_dot_columns_with_workers(
columns: &[&Self],
serial: bool,
max_workers: usize,
)
pub fn materialize_dot_columns_with_workers( columns: &[&Self], serial: bool, max_workers: usize, )
As Self::materialize_dot_columns_with_mode, but with the worker cap
passed IN. See ScalarValues::materialize_dot_columns_with_workers.
Sourcepub fn materialize_dot_columns_with_policy(
columns: &[&Self],
serial: bool,
max_workers: usize,
work_per_worker: u128,
)
pub fn materialize_dot_columns_with_policy( columns: &[&Self], serial: bool, max_workers: usize, work_per_worker: u128, )
As Self::materialize_dot_columns_with_workers, but with the
work-per-worker threshold passed IN. See
ScalarValues::materialize_dot_columns_with_policy.
br-frankenpandas-oarkz. A test fixture is thousands of times smaller than a benchmark frame, so under the shipped threshold every fixture would size itself down to one worker — and every “parallel arm” test in this file would quietly stop testing the parallel arm. Passing the threshold in is what keeps those tests honest, and it is the same in-process A/B hook the serial flag and the worker cap already have.
pub fn as_f64_slice(&self) -> Option<&[f64]>
Sourcepub fn as_i64_slice(&self) -> Option<&[i64]>
pub fn as_i64_slice(&self) -> Option<&[i64]>
Borrow the column’s contiguous i64 buffer when this is an all-valid
Int64 column. See Column::as_f64_slice.
Sourcepub fn as_timedelta64_slice(&self) -> Option<&[i64]>
pub fn as_timedelta64_slice(&self) -> Option<&[i64]>
Borrow the raw &[i64] nanosecond backing of a Timedelta64 column.
Sibling of Self::as_datetime64_slice: the lazy backings’ nanos, or
ColumnData::Timedelta64 of a Scalar-built column. Missing values are
Timedelta::NAT in the buffer, so callers handle NaT inline.
Returns None for any other dtype or a non-materialized column.
Sourcepub fn from_bool_values(data: Vec<bool>) -> Self
pub fn from_bool_values(data: Vec<bool>) -> Self
Build an all-valid Bool column from already-typed contiguous values.
The typed-ingestion counterpart for boolean results (comparison masks,
predicates) — see Column::from_f64_values. Defers Scalar
materialization until a caller asks for scalar values.
Sourcepub fn as_utf8_contiguous_arc(&self) -> Option<Utf8ArcBuffers>
pub fn as_utf8_contiguous_arc(&self) -> Option<Utf8ArcBuffers>
Owned Arc handles to the same contiguous Utf8 backing that
Self::as_utf8_contiguous exposes by reference.
perf/unblock (br-frankenpandas-vrjrf): as_utf8_contiguous hands back
BORROWED (&[u8], &[usize]), which is the only reason the parallel string
kernels must use std::thread::scope — the borrow may not outlive the
call. The backing is already Arc<[u8]> / Arc<[usize]>, and Arc<T> is
Send + Sync whenever T is, so returning CLONED Arcs instead lets a
worker own its view for as long as it likes: no borrowed-slice lifetime,
hence no scoped threads and no unsafe for the DATA side.
Both clones are O(1) refcount bumps, never buffer copies, and the backing is immutable after construction, so a reader can never observe a change underneath it.
Declines under exactly the same conditions as Self::as_utf8_contiguous
(non-Utf8 dtype, any missing row, or a non-contiguous backing) and resolves
the same two backings, so the two accessors agree row-for-row: row r is
bytes[offsets[r]..offsets[r + 1]] under both.
NOTE for pool work: this removes the data-lifetime constraint but NOT the
predicate one. A 'static worker pool also needs a 'static job, and the
current apply_str_bool / apply_str_bytes_bool callers pass closures
that BORROW their pattern (|s| s.contains(pat)). Making those 'static
(owned pattern captures) is a separate, still-safe step — see the
br-frankenpandas-vrjrf notes.
Sourcepub fn as_nullable_utf8_contiguous(&self) -> Option<(&[u8], &[usize])>
pub fn as_nullable_utf8_contiguous(&self) -> Option<(&[u8], &[usize])>
Raw contiguous byte backing of a NULLABLE Utf8 column (LazyNullableUtf8 —
a string column WITH missing rows). Returns (bytes, offsets) where a
present row r is bytes[offsets[r]..offsets[r+1]] and a missing row’s
span is empty; pair with Self::validity (validity.get(r) is false at
missing rows) to distinguish present from missing without materializing the
Vec<Scalar::Utf8>. None for any other backing (all-valid Utf8 uses
Self::as_utf8_contiguous; eager/other dtypes have no contiguous span
view). Sibling of as_utf8_contiguous for consumers that render/scan a
nullable string column by span (e.g. the typed CSV/JSON writers).
Sourcepub fn as_masked_i64_slice(&self) -> Option<(&[i64], &ValidityMask)>
pub fn as_masked_i64_slice(&self) -> Option<(&[i64], &ValidityMask)>
A masked Int64 column’s ints and mask, read from the backings
Self::as_i64_slice_with_validity reads for int64 (a missing row’s
datum is arbitrary): astype("Int64") retags an int64 buffer, and its
reductions went through a Scalar a row (s.astype(“Int64”).sum() 0.5x
pandas; br-frankenpandas-pg40q). None for any other dtype or backing.
Sourcepub fn as_nullable_bool_slice(&self) -> Option<(&[bool], &ValidityMask)>
pub fn as_nullable_bool_slice(&self) -> Option<(&[bool], &ValidityMask)>
Raw packed &[bool] backing + validity of a NULLABLE Bool column
(LazyNullableBool — a boolean column WITH missing rows). A present row
r (validity.get(r)) is data[r]; a missing row’s datum is arbitrary
(masked). None for any other backing (all-valid Bool uses
Self::as_bool_slice; eager/other dtypes are excluded). Sibling of
as_nullable_utf8_contiguous for consumers that render a nullable bool
column by raw bit (e.g. the typed CSV/JSON writers).
Sourcepub fn as_fixed_width_strictly_increasing_utf8_contiguous(
&self,
) -> Option<(&[u8], &[usize], usize)>
pub fn as_fixed_width_strictly_increasing_utf8_contiguous( &self, ) -> Option<(&[u8], &[usize], usize)>
Borrow a strict contiguous-Utf8 backing and its fixed row byte width.
The fixed-width witness is cached next to the strict-increasing witness: ordered string joins can then detect a long equal byte window once and emit a whole range of 1:1 matches without per-row byte-span comparisons.
Sourcepub fn as_bool_slice(&self) -> Option<&[bool]>
pub fn as_bool_slice(&self) -> Option<&[bool]>
Borrow the column’s contiguous bool buffer when this is an all-valid
Bool column. See Column::as_f64_slice.
Sourcepub fn take_positions(&self, positions: &[usize]) -> Self
pub fn take_positions(&self, positions: &[usize]) -> Self
Gather a new column from the given row positions of self.
This is the fast path for materialization (take, iloc, boolean
filter, sort_values, drop_duplicates, reindex, head/tail,
groupby row selection). Because every gathered value originates from
self it already matches self.dtype (no coercion needed), so this
skips the dtype-coercion and object-bucket detection scans that
Column::new performs. All-valid source columns clone values directly
and emit an all-valid mask; missing-bearing columns clone the stored
scalar exactly and rebuild validity from that scalar.
Row gather is a structural reorder, not a dtype-construction boundary: the output preserves the exact stored scalar/null kind at each selected source row, and recomputes validity from those gathered scalars.
§Panics
Panics if any position is out of bounds (callers materialize from
validated index positions; this mirrors the prior values()[pos] index).
Sourcepub fn take_contiguous_range(&self, start: usize, len: usize) -> Self
pub fn take_contiguous_range(&self, start: usize, len: usize) -> Self
Gather a contiguous row range without first materializing
start..start + len as a positions vector.
§Panics
Panics if the requested range overflows or extends beyond this column.
Sourcepub fn zeros(n: usize, dtype: DType) -> Result<Self, ColumnError>
pub fn zeros(n: usize, dtype: DType) -> Result<Self, ColumnError>
Create a column filled with zeros.
Matches np.zeros().
Sourcepub fn ones(n: usize, dtype: DType) -> Result<Self, ColumnError>
pub fn ones(n: usize, dtype: DType) -> Result<Self, ColumnError>
Create a column filled with ones.
Matches np.ones().
Sourcepub fn full(n: usize, fill_value: Scalar) -> Result<Self, ColumnError>
pub fn full(n: usize, fill_value: Scalar) -> Result<Self, ColumnError>
Create a column filled with a given value.
Matches np.full().
Sourcepub fn zeros_like(&self) -> Result<Self, ColumnError>
pub fn zeros_like(&self) -> Result<Self, ColumnError>
Create a zeros column with same shape and dtype as self.
Sourcepub fn ones_like(&self) -> Result<Self, ColumnError>
pub fn ones_like(&self) -> Result<Self, ColumnError>
Create a ones column with same shape and dtype as self.
Sourcepub fn full_like(&self, fill_value: Scalar) -> Result<Self, ColumnError>
pub fn full_like(&self, fill_value: Scalar) -> Result<Self, ColumnError>
Create a column filled with fill_value with same shape as self.
Sourcepub fn empty_like(&self) -> Result<Self, ColumnError>
pub fn empty_like(&self) -> Result<Self, ColumnError>
Create an empty column with same dtype as self.
Sourcepub fn arange(start: f64, stop: f64, step: f64) -> Result<Self, ColumnError>
pub fn arange(start: f64, stop: f64, step: f64) -> Result<Self, ColumnError>
Create a column with evenly spaced values in [start, stop).
Matches np.arange().
Sourcepub fn linspace(start: f64, stop: f64, num: usize) -> Result<Self, ColumnError>
pub fn linspace(start: f64, stop: f64, num: usize) -> Result<Self, ColumnError>
Create a column with evenly spaced values over [start, stop].
Matches np.linspace().
Sourcepub fn logspace(start: f64, stop: f64, num: usize) -> Result<Self, ColumnError>
pub fn logspace(start: f64, stop: f64, num: usize) -> Result<Self, ColumnError>
Create a column with evenly spaced values on a log scale.
Matches np.logspace().
Sourcepub fn geomspace(start: f64, stop: f64, num: usize) -> Result<Self, ColumnError>
pub fn geomspace(start: f64, stop: f64, num: usize) -> Result<Self, ColumnError>
Create values evenly spaced on a log scale (geometric progression).
Matches np.geomspace(start, stop, num). Unlike logspace, start and stop are the actual boundary values (not exponents).
Sourcepub fn hanning(m: usize) -> Result<Self, ColumnError>
pub fn hanning(m: usize) -> Result<Self, ColumnError>
Generate a Hann (Hanning) window.
Matches np.hanning(M). Returns a raised cosine window of length M.
Sourcepub fn hamming(m: usize) -> Result<Self, ColumnError>
pub fn hamming(m: usize) -> Result<Self, ColumnError>
Generate a Hamming window.
Matches np.hamming(M). Returns a Hamming window of length M.
Sourcepub fn blackman(m: usize) -> Result<Self, ColumnError>
pub fn blackman(m: usize) -> Result<Self, ColumnError>
Generate a Blackman window.
Matches np.blackman(M). Returns a Blackman window of length M.
Sourcepub fn bartlett(m: usize) -> Result<Self, ColumnError>
pub fn bartlett(m: usize) -> Result<Self, ColumnError>
Generate a Bartlett (triangular) window.
Matches np.bartlett(M). Returns a triangular window of length M.
pub fn dtype(&self) -> DType
pub fn categorical(&self) -> Option<&CategoricalMetadata>
pub fn with_categorical(&self, categorical: Option<CategoricalMetadata>) -> Self
Sourcepub fn from_categorical_codes(
codes: Vec<i32>,
meta: CategoricalMetadata,
) -> Self
pub fn from_categorical_codes( codes: Vec<i32>, meta: CategoricalMetadata, ) -> Self
A categorical column whose row i is category codes[i] of meta
(-1: missing), held as the codes (br-frankenpandas-5oup5).
Sourcepub fn stack_categorical_codes(
pieces: &[&Self],
meta: &CategoricalMetadata,
) -> Option<Self>
pub fn stack_categorical_codes( pieces: &[&Self], meta: &CategoricalMetadata, ) -> Option<Self>
Categoricals held as codes over meta’s categories stacked end to
end: their codes copied and their validity words joined - each
piece’s codes already -1 where missing, so nothing is derived again a
row (the codes were validated again: 41% of a two-categorical
concat, 0.45x pandas; br-frankenpandas-iqh7m). None unless every
piece holds codes over meta.
Sourcepub fn with_categories_sharing_codes(
&self,
meta: CategoricalMetadata,
) -> Option<Self>
pub fn with_categories_sharing_codes( &self, meta: CategoricalMetadata, ) -> Option<Self>
This column’s codes over meta’s categories - at least as many as
its own, so each code still names its place - its codes and validity
shared, not copied (a categorical’s categories renamed or added to:
each code was made, checked and packed again, rename_categories
0.35x pandas; br-frankenpandas-nk9mh). None unless it is held as
codes over its metadata’s categories.
Sourcepub fn categorical_codes(&self) -> Option<&[i32]>
pub fn categorical_codes(&self) -> Option<&[i32]>
The category codes (-1: missing) of a column held as codes
(Self::from_categorical_codes, a cut’s bins) while its categorical
metadata names the categories they index; None for any other column.
Sourcepub const fn width(&self) -> Option<NumericWidth>
pub const fn width(&self) -> Option<NumericWidth>
The numpy dtype narrower than the storage that pandas reports for
this column (int32, uint8, float32, …), or None for the storage’s
own dtype (fvsao.23).
Sourcepub fn keeping_dtype_of(self, source: &Self) -> Self
pub fn keeping_dtype_of(self, source: &Self) -> Self
result, a structural operation’s output over source’s rows (a
take, slice, reindex, concat), with source‘s dtype refinement where
the result’s storage carries it - its width, and pandas’ string
dtype over Utf8. An int32 column reindexed onto missing rows became
float64, which is not int32’s storage, so it reports float64 as pandas
does - and a numpy Int64 storage left holding a missing value is no
numpy integer column either. The values are source’s, so already
confined; a result holding new values goes through
Self::narrowed_like. Public for a caller’s own gather of
source’s rows (a typed fast path building the column itself); it
must hold only source’s values.
Sourcepub fn narrowed_like(self, source: &Self) -> Self
pub fn narrowed_like(self, source: &Self) -> Self
self, an operation’s result holding source’s values and maybe
values it added (a fill, a bound, a row a join invented), in
source’s width where pandas keeps it: carried where the storage
can (see Self::keeping_dtype_of), then confined to it - float32
rounds, an integer width is dropped when an added value left its
range.
Sourcepub const fn is_pandas_string(&self) -> bool
pub const fn is_pandas_string(&self) -> bool
Whether this is pandas’ string extension dtype over its Utf8
storage (fvsao.59).
Sourcepub fn as_pandas_string(self) -> Self
pub fn as_pandas_string(self) -> Self
This Utf8 column as pandas’ string dtype (the caller made its values
text or missing); any other column unchanged.
Sourcepub fn with_width_dropped(self) -> Self
pub fn with_width_dropped(self) -> Self
This column with no numpy width: its values and storage the same, read as int64 / float64 (a caller running a float64 kernel whose result it narrows back, as pandas computes a float32 std in float64).
Sourcepub fn cast_to_width(
&self,
width: NumericWidth,
nullable: bool,
) -> Result<Self, ColumnError>
pub fn cast_to_width( &self, width: NumericWidth, nullable: bool, ) -> Result<Self, ColumnError>
This column as the numpy dtype width - astype('int8'),
Series(..., dtype='float32') - over the nullable storage when
nullable (pandas’ Int8 … Float32): the values are first cast to
the storage as Self::astype casts them (text parsed, a float
truncated toward zero, a missing value refused by a numpy integer
target), then an integer width wraps each (astype('int8') of 300
is 44, astype('uint8') of -5 is 251) and float32 rounds each to
the nearest f32.
§Errors
Self::astype’s; IntCastingNaN for a missing or infinite value
cast to a numpy (not nullable) integer width; UInt64OutOfRange for
a uint64 value at or above 2**63 (a negative value’s uint64 wrap),
which the storage cannot hold.
Sourcepub fn promote_to_nullable(&self) -> Self
pub fn promote_to_nullable(&self) -> Self
Promote the dtype to its nullable variant if the column has nulls.
For Int64 with nulls → Int64Nullable, Bool with nulls → BoolNullable. For already-nullable or other dtypes, returns a clone unchanged.
Sourcepub fn with_dtype(&self, dtype: DType) -> Self
pub fn with_dtype(&self, dtype: DType) -> Self
Create a new column with a different dtype, preserving the same values.
This is a low-level operation that only changes the dtype metadata without converting values. Use only when the values are already valid for the target dtype.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn copy(&self) -> Self
pub fn copy(&self) -> Self
Return a deep copy of this column.
Matches pd.Series.copy(deep=True) at the column storage layer.
Sourcepub fn view(&self) -> Self
pub fn view(&self) -> Self
Return an immutable view-shaped clone of this column.
Matches pd.Series.view() at the column storage layer.
Sourcepub fn transpose(&self) -> Self
pub fn transpose(&self) -> Self
One-dimensional transpose is identity.
Matches pd.Series.transpose() at the column storage layer.
pub fn values(&self) -> &[Scalar]
pub fn value(&self, idx: usize) -> Option<&Scalar>
Sourcepub fn scalar_at(&self, idx: usize) -> Option<Scalar>
pub fn scalar_at(&self, idx: usize) -> Option<Scalar>
The cell at idx (values()[idx]) without building the column’s
Scalar view when its typed backing holds the cell (a single-cell or
single-row read built the whole view; br-frankenpandas-rrulv). None
past the end.
Sourcepub fn item(&self) -> Result<Scalar, ColumnError>
pub fn item(&self) -> Result<Scalar, ColumnError>
Extract scalar value from a single-element column.
Matches pd.Series.item() at the column storage layer. Returns an
error unless the column has exactly one element.
pub fn validity(&self) -> &ValidityMask
Sourcepub fn iter_values(&self) -> Iter<'_, Scalar> ⓘ
pub fn iter_values(&self) -> Iter<'_, Scalar> ⓘ
Borrow-returning iterator over the column’s scalars.
Convenience over self.values().iter() so call sites don’t
have to reach through the slice accessor. Preserves
position order.
Sourcepub fn to_vec(&self) -> Vec<Scalar>
pub fn to_vec(&self) -> Vec<Scalar>
Materialize the column’s values into an owned Vec<Scalar>.
Matches pd.Series.to_list(). Equivalent to
self.values().to_vec(); the shorthand survives refactors
that change the internal storage shape.
Sourcepub fn to_numpy(&self) -> Vec<Scalar>
pub fn to_numpy(&self) -> Vec<Scalar>
Owned scalar materialization, matching pd.Series.to_numpy().
Sourcepub fn ravel(&self) -> Vec<Scalar>
pub fn ravel(&self) -> Vec<Scalar>
Flatten values to a one-dimensional vector, matching pd.Series.ravel().
Sourcepub fn flatten(&self) -> Vec<Scalar>
pub fn flatten(&self) -> Vec<Scalar>
Flatten values to a copy, matching np.ndarray.flatten().
For 1D arrays this is equivalent to ravel() but explicitly returns an owned copy rather than potentially a view.
Sourcepub fn asarray(&self) -> Self
pub fn asarray(&self) -> Self
Convert to array, matching np.asarray().
For Column this returns a clone since we’re already array-like.
Sourcepub fn has_any_missing(&self) -> bool
pub fn has_any_missing(&self) -> bool
Whether any value in the column is missing.
Matches pd.Series.isna().any() in one pass. Faster than
calling isnull() and scanning — returns on the first
missing value seen.
Sourcepub fn all_missing(&self) -> bool
pub fn all_missing(&self) -> bool
Whether every value in the column is missing.
Matches pd.Series.isna().all(). Empty columns return true
(vacuously), mirroring ValidityMask::all’s empty-case
convention.
Sourcepub fn first(&self) -> Option<&Scalar>
pub fn first(&self) -> Option<&Scalar>
First value in the column (index 0), or None when empty.
Matches pd.Series.iloc[0] shorthand. Returns the raw Scalar
including missing markers; callers who want skipna semantics
can pair with has_any_missing.
Sourcepub fn count_matching<F>(&self, predicate: F) -> usize
pub fn count_matching<F>(&self, predicate: F) -> usize
Count values for which predicate returns true.
Complement to apply_bool that yields only the count rather
than materializing a Bool column. Missing inputs are treated
as a non-match (consistent with apply_bool’s
missing→Bool(false) contract).
Sourcepub fn zip_with<F>(&self, other: &Self, func: F) -> Result<Self, ColumnError>
pub fn zip_with<F>(&self, other: &Self, func: F) -> Result<Self, ColumnError>
Elementwise combine with another column via a user function.
Matches pd.Series.combine(other, func) at the Column layer
without the pandas fill_value=None null-propagation policy
— zip_with always invokes func, passing through missing
values as-is so the caller decides whether to short-circuit
nulls. Length mismatch returns LengthMismatch.
Sourcepub fn iter_enumerate(&self) -> Enumerate<Iter<'_, Scalar>> ⓘ
pub fn iter_enumerate(&self) -> Enumerate<Iter<'_, Scalar>> ⓘ
(position, scalar) iterator.
Shortcut for iter_values().enumerate(). Convenience for
callers that need both positions and values and don’t want
to reach through the slice accessor.
Sourcepub fn apply_bool<F>(&self, predicate: F) -> Result<Self, ColumnError>
pub fn apply_bool<F>(&self, predicate: F) -> Result<Self, ColumnError>
Apply a predicate per value and collect the results into a Bool column.
Like Column::map but specialized for predicate functions
returning bool. Missing inputs produce Scalar::Bool(false)
by default — callers that need null propagation should use
map instead so they can emit Null(NaN) explicitly.
pub fn reindex_by_positions( &self, positions: &[Option<usize>], ) -> Result<Self, ColumnError>
Sourcepub fn aligned_binary_f64(
&self,
right: &Self,
left_positions: &[Option<usize>],
right_positions: &[Option<usize>],
op: ArithmeticOp,
) -> Result<Self, ColumnError>
pub fn aligned_binary_f64( &self, right: &Self, left_positions: &[Option<usize>], right_positions: &[Option<usize>], op: ArithmeticOp, ) -> Result<Self, ColumnError>
AG-10 fused outer-alignment arithmetic for two Float64 columns.
Equivalent to self.reindex_by_positions(lp)?.binary_numeric( &right.reindex_by_positions(rp)?, op) for the Float64-output case, but it
gathers f64 directly from the original columns into the union layout
in one pass instead of materializing two intermediate Vec<Scalar> and
re-deriving their f64 views. Provably isomorphic: from_scalars is
element-wise and reindex is a gather, so gather(from_scalars(src)) == from_scalars(reindex(src)); the nan-aware validity gathers identically
(a None slot reindexes to missing_for_dtype(Float64) = Null(NaN),
i.e. invalid, exactly as the gathered mask marks it). For Float64 output
every invalid position is Null(NaN) — matching both arms of
try_vectorized_binary’s invalid branch. Caller guarantees both columns
are Float64.
Sourcepub fn aligned_binary_f64_int64_unit_ranges(
&self,
right: &Self,
left_range: (i64, i64),
right_range: (i64, i64),
union_range: (i64, i64),
op: ArithmeticOp,
) -> Result<Self, ColumnError>
pub fn aligned_binary_f64_int64_unit_ranges( &self, right: &Self, left_range: (i64, i64), right_range: (i64, i64), union_range: (i64, i64), op: ArithmeticOp, ) -> Result<Self, ColumnError>
Fused Float64 arithmetic for two aligned contiguous Int64 unit ranges.
The caller has proven the left and right indexes are [start, end]
integer ranges and the output index is their contiguous union. This is
isomorphic to Self::aligned_binary_f64 with arithmetic positions, but
it fills the overlapped span directly and leaves non-overlap slots
invalid, avoiding the two Vec<Option<usize>> alignment buffers.
Sourcepub fn aligned_binary_i64_int64_unit_ranges(
&self,
right: &Self,
left_range: (i64, i64),
right_range: (i64, i64),
union_range: (i64, i64),
op: ArithmeticOp,
) -> Result<Self, ColumnError>
pub fn aligned_binary_i64_int64_unit_ranges( &self, right: &Self, left_range: (i64, i64), right_range: (i64, i64), union_range: (i64, i64), op: ArithmeticOp, ) -> Result<Self, ColumnError>
Fused Float64-producing arithmetic for two Int64 columns aligned by
contiguous Int64 unit ranges.
Outer alignment necessarily introduces a gap when indexes differ, so
pandas widens the arithmetic result to Float64. This consumes the two
typed Int64 buffers directly, avoiding both position vectors and the
Scalar reindex/promotion round-trip.
Sourcepub fn binary_scalar(
&self,
scalar: &Scalar,
op: ArithmeticOp,
scalar_left: bool,
) -> Option<Self>
pub fn binary_scalar( &self, scalar: &Scalar, op: ArithmeticOp, scalar_left: bool, ) -> Option<Self>
self <op> scalar (scalar <op> self when scalar_left) without the
scalar’s broadcast column (br-frankenpandas-pnxo5): for an all-valid
Float64 column and a non-NaN number, + - * /, the column
Self::aligned_binary_f64_same_positions makes of self and that
broadcast; for an all-valid Int64 column and an Int64 scalar, + - *,
the wrapping column Self::binary_numeric makes. A Float64 column
** a number is numpy’s power by one number (power_by_number),
which that broadcast cannot give: an array of exponents is pow.
None for anything else - the caller broadcasts.
Sourcepub fn aligned_binary_f64_same_positions(
&self,
right: &Self,
op: ArithmeticOp,
) -> Result<Self, ColumnError>
pub fn aligned_binary_f64_same_positions( &self, right: &Self, op: ArithmeticOp, ) -> Result<Self, ColumnError>
Same-index Float64 arithmetic fast path.
Isomorphic to calling Self::aligned_binary_f64 with
Some(i)/Some(i) positions for every row, but avoids allocating and
walking the identity alignment vectors.
pub fn binary_numeric( &self, right: &Self, op: ArithmeticOp, ) -> Result<Self, ColumnError>
Sourcepub fn add(&self, right: &Self) -> Result<Self, ColumnError>
pub fn add(&self, right: &Self) -> Result<Self, ColumnError>
Element-wise addition, matching pd.Series.add().
Sourcepub fn radd(&self, left: &Self) -> Result<Self, ColumnError>
pub fn radd(&self, left: &Self) -> Result<Self, ColumnError>
Reverse element-wise addition, matching pd.Series.radd().
Sourcepub fn sub(&self, right: &Self) -> Result<Self, ColumnError>
pub fn sub(&self, right: &Self) -> Result<Self, ColumnError>
Element-wise subtraction, matching pd.Series.sub().
Sourcepub fn rsub(&self, left: &Self) -> Result<Self, ColumnError>
pub fn rsub(&self, left: &Self) -> Result<Self, ColumnError>
Reverse element-wise subtraction, matching pd.Series.rsub().
Sourcepub fn subtract(&self, right: &Self) -> Result<Self, ColumnError>
pub fn subtract(&self, right: &Self) -> Result<Self, ColumnError>
Alias for sub, matching pd.Series.subtract().
Sourcepub fn mul(&self, right: &Self) -> Result<Self, ColumnError>
pub fn mul(&self, right: &Self) -> Result<Self, ColumnError>
Element-wise multiplication, matching pd.Series.mul().
Sourcepub fn rmul(&self, left: &Self) -> Result<Self, ColumnError>
pub fn rmul(&self, left: &Self) -> Result<Self, ColumnError>
Reverse element-wise multiplication, matching pd.Series.rmul().
Sourcepub fn multiply(&self, right: &Self) -> Result<Self, ColumnError>
pub fn multiply(&self, right: &Self) -> Result<Self, ColumnError>
Alias for mul, matching pd.Series.multiply().
Sourcepub fn div(&self, right: &Self) -> Result<Self, ColumnError>
pub fn div(&self, right: &Self) -> Result<Self, ColumnError>
Element-wise true division, matching pd.Series.div().
Sourcepub fn rdiv(&self, left: &Self) -> Result<Self, ColumnError>
pub fn rdiv(&self, left: &Self) -> Result<Self, ColumnError>
Reverse element-wise true division, matching pd.Series.rdiv().
Sourcepub fn divide(&self, right: &Self) -> Result<Self, ColumnError>
pub fn divide(&self, right: &Self) -> Result<Self, ColumnError>
Alias for div, matching pd.Series.divide().
Sourcepub fn truediv(&self, right: &Self) -> Result<Self, ColumnError>
pub fn truediv(&self, right: &Self) -> Result<Self, ColumnError>
Alias for div, matching pd.Series.truediv().
Sourcepub fn rtruediv(&self, left: &Self) -> Result<Self, ColumnError>
pub fn rtruediv(&self, left: &Self) -> Result<Self, ColumnError>
Alias for rdiv, matching pd.Series.rtruediv().
Sourcepub fn floordiv(&self, right: &Self) -> Result<Self, ColumnError>
pub fn floordiv(&self, right: &Self) -> Result<Self, ColumnError>
Element-wise floor division, matching pd.Series.floordiv().
Sourcepub fn rfloordiv(&self, left: &Self) -> Result<Self, ColumnError>
pub fn rfloordiv(&self, left: &Self) -> Result<Self, ColumnError>
Reverse element-wise floor division, matching pd.Series.rfloordiv().
Sourcepub fn mod(&self, right: &Self) -> Result<Self, ColumnError>
pub fn mod(&self, right: &Self) -> Result<Self, ColumnError>
Element-wise modulo, matching pd.Series.mod().
Sourcepub fn rmod(&self, left: &Self) -> Result<Self, ColumnError>
pub fn rmod(&self, left: &Self) -> Result<Self, ColumnError>
Reverse element-wise modulo, matching pd.Series.rmod().
Sourcepub fn pow(&self, right: &Self) -> Result<Self, ColumnError>
pub fn pow(&self, right: &Self) -> Result<Self, ColumnError>
Element-wise exponentiation, matching pd.Series.pow().
Sourcepub fn rpow(&self, left: &Self) -> Result<Self, ColumnError>
pub fn rpow(&self, left: &Self) -> Result<Self, ColumnError>
Reverse element-wise exponentiation, matching pd.Series.rpow().
Sourcepub fn power(&self, right: &Self) -> Result<Self, ColumnError>
pub fn power(&self, right: &Self) -> Result<Self, ColumnError>
Alias for pow, matching NumPy naming.
Sourcepub fn float_power(&self, right: &Self) -> Result<Self, ColumnError>
pub fn float_power(&self, right: &Self) -> Result<Self, ColumnError>
Float power, always returning Float64.
Matches np.float_power(x, y). Unlike power(), this always returns Float64 and returns NaN for negative bases with non-integer exponents (where the result would be complex).
Sourcepub fn remainder(&self, right: &Self) -> Result<Self, ColumnError>
pub fn remainder(&self, right: &Self) -> Result<Self, ColumnError>
Alias for mod, matching NumPy naming.
Sourcepub fn floor_divide(&self, right: &Self) -> Result<Self, ColumnError>
pub fn floor_divide(&self, right: &Self) -> Result<Self, ColumnError>
Alias for floordiv, matching NumPy naming.
Sourcepub fn true_divide(&self, right: &Self) -> Result<Self, ColumnError>
pub fn true_divide(&self, right: &Self) -> Result<Self, ColumnError>
Alias for div, matching NumPy naming.
Sourcepub fn atan2(&self, other: &Self) -> Result<Self, ColumnError>
pub fn atan2(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise arctangent of y/x.
Sourcepub fn hypot(&self, other: &Self) -> Result<Self, ColumnError>
pub fn hypot(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise Euclidean distance sqrt(x^2 + y^2).
Sourcepub fn fmod(&self, other: &Self) -> Result<Self, ColumnError>
pub fn fmod(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise floating-point remainder (fmod).
Sourcepub fn copysign(&self, other: &Self) -> Result<Self, ColumnError>
pub fn copysign(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise copysign: magnitude of self with sign of other.
Sourcepub fn sign(&self) -> Result<Self, ColumnError>
pub fn sign(&self) -> Result<Self, ColumnError>
Element-wise sign: -1, 0, or 1.
Sourcepub fn signbit(&self) -> Result<Self, ColumnError>
pub fn signbit(&self) -> Result<Self, ColumnError>
Test element-wise for negative sign bit.
Matches np.signbit(x). Returns True for negative values including -0.0.
Sourcepub fn heaviside(&self, h0: f64) -> Result<Self, ColumnError>
pub fn heaviside(&self, h0: f64) -> Result<Self, ColumnError>
Compute the Heaviside step function.
Matches np.heaviside(x, h0). Returns:
- 0 where x < 0
- h0 where x == 0
- 1 where x > 0
Sourcepub fn gcd(&self, other: &Self) -> Result<Self, ColumnError>
pub fn gcd(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise greatest common divisor.
Matches np.gcd(x, y). Works on integer values.
Sourcepub fn lcm(&self, other: &Self) -> Result<Self, ColumnError>
pub fn lcm(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise least common multiple.
Matches np.lcm(x, y). Works on integer values.
Sourcepub fn bitwise_and(&self, other: &Self) -> Result<Self, ColumnError>
pub fn bitwise_and(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise bitwise AND.
Sourcepub fn bitwise_or(&self, other: &Self) -> Result<Self, ColumnError>
pub fn bitwise_or(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise bitwise OR.
Sourcepub fn bitwise_xor(&self, other: &Self) -> Result<Self, ColumnError>
pub fn bitwise_xor(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise bitwise XOR.
Sourcepub fn left_shift(&self, other: &Self) -> Result<Self, ColumnError>
pub fn left_shift(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise left bit shift.
Matches np.left_shift(x, y). Shifts bits of x left by y positions.
Sourcepub fn right_shift(&self, other: &Self) -> Result<Self, ColumnError>
pub fn right_shift(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise right bit shift.
Matches np.right_shift(x, y). Shifts bits of x right by y positions.
Sourcepub fn bitwise_not(&self) -> Result<Self, ColumnError>
pub fn bitwise_not(&self) -> Result<Self, ColumnError>
Element-wise bitwise NOT (invert).
Sourcepub fn invert(&self) -> Result<Self, ColumnError>
pub fn invert(&self) -> Result<Self, ColumnError>
Alias for bitwise_not.
Sourcepub fn maximum(&self, other: &Self) -> Result<Self, ColumnError>
pub fn maximum(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise maximum, NaN propagates.
Sourcepub fn minimum(&self, other: &Self) -> Result<Self, ColumnError>
pub fn minimum(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise minimum, NaN propagates.
Sourcepub fn fmax(&self, other: &Self) -> Result<Self, ColumnError>
pub fn fmax(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise maximum, ignoring NaN.
Sourcepub fn fmin(&self, other: &Self) -> Result<Self, ColumnError>
pub fn fmin(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise minimum, ignoring NaN.
Sourcepub fn logical_and(&self, other: &Self) -> Result<Self, ColumnError>
pub fn logical_and(&self, other: &Self) -> Result<Self, ColumnError>
Logical AND between two boolean columns.
Sourcepub fn logical_or(&self, other: &Self) -> Result<Self, ColumnError>
pub fn logical_or(&self, other: &Self) -> Result<Self, ColumnError>
Logical OR between two boolean columns.
Sourcepub fn logical_xor(&self, other: &Self) -> Result<Self, ColumnError>
pub fn logical_xor(&self, other: &Self) -> Result<Self, ColumnError>
Logical XOR between two boolean columns.
Sourcepub fn logical_not(&self) -> Result<Self, ColumnError>
pub fn logical_not(&self) -> Result<Self, ColumnError>
Logical NOT (element-wise negation to boolean).
Sourcepub fn binary_comparison(
&self,
right: &Self,
op: ComparisonOp,
) -> Result<Self, ColumnError>
pub fn binary_comparison( &self, right: &Self, op: ComparisonOp, ) -> Result<Self, ColumnError>
Element-wise comparison producing an all-valid Bool column, with
pandas’ numpy semantics: a missing operand (NaN, None, NaT) compares
false, or true under !=. Only when an operand has a nullable
extension dtype (Int64/Float64/boolean) is the result missing there, as
pandas’ pd.NA propagates (br-frankenpandas-zwfz3: every missing
operand gave a missing result).
Both columns must have the same length.
Sourcepub fn eq(&self, right: &Self) -> Result<Self, ColumnError>
pub fn eq(&self, right: &Self) -> Result<Self, ColumnError>
Element-wise equality, matching pd.Series.eq().
Sourcepub fn ne(&self, right: &Self) -> Result<Self, ColumnError>
pub fn ne(&self, right: &Self) -> Result<Self, ColumnError>
Element-wise inequality, matching pd.Series.ne().
Sourcepub fn lt(&self, right: &Self) -> Result<Self, ColumnError>
pub fn lt(&self, right: &Self) -> Result<Self, ColumnError>
Element-wise less-than comparison, matching pd.Series.lt().
Sourcepub fn le(&self, right: &Self) -> Result<Self, ColumnError>
pub fn le(&self, right: &Self) -> Result<Self, ColumnError>
Element-wise less-than-or-equal comparison, matching pd.Series.le().
Sourcepub fn gt(&self, right: &Self) -> Result<Self, ColumnError>
pub fn gt(&self, right: &Self) -> Result<Self, ColumnError>
Element-wise greater-than comparison, matching pd.Series.gt().
Sourcepub fn ge(&self, right: &Self) -> Result<Self, ColumnError>
pub fn ge(&self, right: &Self) -> Result<Self, ColumnError>
Element-wise greater-than-or-equal comparison, matching pd.Series.ge().
Sourcepub fn compare_scalar(
&self,
scalar: &Scalar,
op: ComparisonOp,
) -> Result<Self, ColumnError>
pub fn compare_scalar( &self, scalar: &Scalar, op: ComparisonOp, ) -> Result<Self, ColumnError>
Compare every element against a scalar value, producing an all-valid
Bool column under pandas’ numpy semantics: a missing element, or a
missing scalar, compares false (true under !=). A nullable
extension dtype keeps pd.NA propagation (see
binary_comparison; br-frankenpandas-zwfz3).
Sourcepub fn filter_by_mask(&self, mask: &Self) -> Result<Self, ColumnError>
pub fn filter_by_mask(&self, mask: &Self) -> Result<Self, ColumnError>
Select elements where mask is true, producing a new column.
The mask must be a Bool-typed column of the same length.
Missing values in the mask are treated as false (not selected).
Sourcepub fn fillna(&self, fill_value: &Scalar) -> Result<Self, ColumnError>
pub fn fillna(&self, fill_value: &Scalar) -> Result<Self, ColumnError>
Fill missing values with a replacement scalar.
Returns a new column where every missing position is replaced
by fill_value. The fill value is cast to the column’s dtype.
Sourcepub fn dropna(&self) -> Result<Self, ColumnError>
pub fn dropna(&self) -> Result<Self, ColumnError>
Remove missing values, returning a shorter column.
Sourcepub fn take(&self, indices: &[usize]) -> Result<Self, ColumnError>
pub fn take(&self, indices: &[usize]) -> Result<Self, ColumnError>
Gather rows by integer position.
Matches pd.Series.take(indices). Each index must fall within
0..len(); out-of-range positions return
ColumnError::LengthMismatch (left=length, right=offending
index).
Sourcepub fn put(
&self,
indices: &[usize],
values: &[Scalar],
) -> Result<Self, ColumnError>
pub fn put( &self, indices: &[usize], values: &[Scalar], ) -> Result<Self, ColumnError>
Replace elements at specified indices with given values.
Matches np.put(). Returns a new column with values replaced at indices.
Sourcepub fn slice(&self, start: usize, len: usize) -> Result<Self, ColumnError>
pub fn slice(&self, start: usize, len: usize) -> Result<Self, ColumnError>
Contiguous slice by positional range start..start+len.
Out-of-range requests are clamped to the available tail so a
start past len() yields an empty column with the same dtype,
matching pandas’ permissive slice semantics.
Sourcepub fn head(&self, n: i64) -> Result<Self, ColumnError>
pub fn head(&self, n: i64) -> Result<Self, ColumnError>
Return the first n values.
Matches pandas head(n) semantics on a 1-D array-like surface.
Negative n returns all values except the last -n.
Sourcepub fn tail(&self, n: i64) -> Result<Self, ColumnError>
pub fn tail(&self, n: i64) -> Result<Self, ColumnError>
Return the last n values.
Matches pandas tail(n) semantics on a 1-D array-like surface.
Negative n returns all values except the first -n.
Sourcepub fn array_split(&self, n: usize) -> Result<Vec<Self>, ColumnError>
pub fn array_split(&self, n: usize) -> Result<Vec<Self>, ColumnError>
Split column into n equal-ish parts.
Matches np.array_split(). Returns Vec of Columns.
Sourcepub fn concat(&self, other: &Self) -> Result<Self, ColumnError>
pub fn concat(&self, other: &Self) -> Result<Self, ColumnError>
Concatenate other onto self, preserving dtype.
Returns ColumnError::DTypeMismatch when other.dtype() differs
from self.dtype().
The rows of self then other, of one dtype; the result’s width is
numpy’s for the pair (int8 then int16 is int16, int32 then int64 is
int64), which holds every value of both.
Sourcepub fn append(&self, other: &Self) -> Result<Self, ColumnError>
pub fn append(&self, other: &Self) -> Result<Self, ColumnError>
Alias for concat, matching np.append.
Sourcepub fn insert(
&self,
index: usize,
values: &[Scalar],
) -> Result<Self, ColumnError>
pub fn insert( &self, index: usize, values: &[Scalar], ) -> Result<Self, ColumnError>
Insert values at given index.
Matches np.insert(). Returns new column with values inserted.
Sourcepub fn delete(&self, indices: &[usize]) -> Result<Self, ColumnError>
pub fn delete(&self, indices: &[usize]) -> Result<Self, ColumnError>
Delete values at given indices.
Matches np.delete(). Returns new column with values removed.
Sourcepub fn resize(&self, new_size: usize) -> Result<Self, ColumnError>
pub fn resize(&self, new_size: usize) -> Result<Self, ColumnError>
Resize column to new size, padding or truncating as needed.
Matches np.resize(). If new size is larger, values cycle from beginning.
Sourcepub fn repeat(&self, repeats: usize) -> Result<Self, ColumnError>
pub fn repeat(&self, repeats: usize) -> Result<Self, ColumnError>
Repeat each value repeats times contiguously.
Matches pd.Series.repeat(n). repeats=0 yields an empty
column; repeats=1 is a clone.
Sourcepub fn tile(&self, reps: usize) -> Result<Self, ColumnError>
pub fn tile(&self, reps: usize) -> Result<Self, ColumnError>
Tile (repeat) the entire column n times.
Matches np.tile(). Unlike repeat which duplicates each element,
tile duplicates the entire array.
Sourcepub fn reverse(&self) -> Result<Self, ColumnError>
pub fn reverse(&self) -> Result<Self, ColumnError>
Reverse the row order of the column.
Matches pd.Series[::-1] / iloc[::-1]. Dtype is preserved.
Sourcepub fn flip(&self) -> Result<Self, ColumnError>
pub fn flip(&self) -> Result<Self, ColumnError>
Alias for reverse, matching np.flip.
Sourcepub fn roll(&self, shift: i64) -> Result<Self, ColumnError>
pub fn roll(&self, shift: i64) -> Result<Self, ColumnError>
Roll array elements along the axis.
Matches np.roll(a, shift). Elements that roll beyond the last position are re-introduced at the first, and vice versa. Positive shift rolls elements to higher indices (right), negative to lower (left).
Sourcepub fn compress(&self, condition: &Self) -> Result<Self, ColumnError>
pub fn compress(&self, condition: &Self) -> Result<Self, ColumnError>
Filter values based on a boolean condition column.
Matches np.compress(). Returns only values where condition is True.
Sourcepub fn cumsum(&self) -> Result<Self, ColumnError>
pub fn cumsum(&self) -> Result<Self, ColumnError>
Cumulative sum, null-propagating per fp-types::nancumsum.
Matches pd.Series.cumsum(). The resulting column is always
Float64 (matching the numeric accumulator type used in
nancumsum).
Sourcepub fn cumprod(&self) -> Result<Self, ColumnError>
pub fn cumprod(&self) -> Result<Self, ColumnError>
Cumulative product, null-propagating per fp-types::nancumprod.
Sourcepub fn cummax(&self) -> Result<Self, ColumnError>
pub fn cummax(&self) -> Result<Self, ColumnError>
Cumulative maximum, null-propagating per fp-types::nancummax.
Sourcepub fn cummin(&self) -> Result<Self, ColumnError>
pub fn cummin(&self) -> Result<Self, ColumnError>
Cumulative minimum, null-propagating per fp-types::nancummin.
Sourcepub fn all_valid_f64_chunk_sum(&self) -> Option<f64>
pub fn all_valid_f64_chunk_sum(&self) -> Option<f64>
Sum of non-missing values.
Sum an all-valid Float64 concat(...) output (LazyAllValidFloat64Chunks)
by folding each chunk slice in place with ONE 0.0-seeded accumulator in
0..n order — BIT-IDENTICAL to as_f64_slice().iter().sum() over the
materialized buffer (same values, same order, same sequential left-fold)
— but WITHOUT allocating+filling the cold concatenated Vec<f64> (the
[[f64-arc-copy-on-produce]] ~5.7 ms/1M page-fault cost). None for any
non-chunked / nullable / non-Float64 column (caller keeps its normal path).
Sourcepub fn all_valid_f64_chunk_mean(&self) -> Option<f64>
pub fn all_valid_f64_chunk_mean(&self) -> Option<f64>
Mean of an all-valid Float64 chunks column (see all_valid_f64_chunk_sum):
Σ / len with the in-place chunk fold; None for empty or non-chunked.
Sourcepub fn all_valid_i64_chunk_sum(&self) -> Option<i64>
pub fn all_valid_i64_chunk_sum(&self) -> Option<i64>
Sum an all-valid Int64 concat(...) output by folding each chunk slice
in place with wrapping_add (0-seeded, 0..n order) — BIT-IDENTICAL to the
materialized as_i64_slice wrapping sum (wrapping_add is associative mod
2^64, so chunk grouping can’t change the result) — without the cold Vec.
Sourcepub fn all_valid_i64_chunk_extreme(&self, want_max: bool) -> Option<i64>
pub fn all_valid_i64_chunk_extreme(&self, want_max: bool) -> Option<i64>
Min/max of an all-valid Int64 concat output via in-place chunk fold
(order-independent — i64::min/max is associative+commutative — so
bit-identical to the materialized reduction). None if empty/non-chunked.
Sourcepub fn all_valid_f64_chunk_extreme(&self, want_max: bool) -> Option<f64>
pub fn all_valid_f64_chunk_extreme(&self, want_max: bool) -> Option<f64>
Min/max of an all-valid Float64 concat output via in-place chunk fold,
replicating Series::max/min’s EXACT reduction — if v > result
(seed −∞) / if v < result (seed +∞), NOT f64::max/min (which would
flip ±0.0) — in 0..n order, so the ±0.0-first-seen tie is preserved
bit-for-bit. Chunks are all-valid (no NaN), so no missing/NaN branch.
None when empty/non-chunked (caller keeps its normal empty handling).
Sourcepub fn all_valid_f64_chunk_slices(&self) -> Option<Vec<&[f64]>>
pub fn all_valid_f64_chunk_slices(&self) -> Option<Vec<&[f64]>>
The chunk slices of an all-valid Float64 concat(...) output, in
order, borrowed without materializing the concatenated buffer - for a
reduction that reads the column in one global order (pandas’ pairwise
sums; br-frankenpandas-9iim6). None for any other column.
Sourcepub fn all_valid_i64_chunk_slices(&self) -> Option<Vec<&[i64]>>
pub fn all_valid_i64_chunk_slices(&self) -> Option<Vec<&[i64]>>
Int64 sibling of Self::all_valid_f64_chunk_slices.
Sourcepub fn all_valid_f64_chunk_product(&self) -> Option<f64>
pub fn all_valid_f64_chunk_product(&self) -> Option<f64>
Product of an all-valid Float64 concat output, folding each chunk slice
in place with a 1.0-seeded * in 0..n order — bit-identical to
as_f64_slice().iter().product() (also a 1.0-seeded sequential left-fold)
— without materializing the cold concat buffer.
Sourcepub fn all_valid_i64_chunk_product(&self) -> Option<i64>
pub fn all_valid_i64_chunk_product(&self) -> Option<i64>
Int64 product sibling (wrapping_mul, associative mod 2^64 ⇒ grouping-
invariant, bit-identical to the materialized fold(1, wrapping_mul)).
Sourcepub fn all_valid_f64_chunk_argextreme(&self, want_max: bool) -> Option<usize>
pub fn all_valid_f64_chunk_argextreme(&self, want_max: bool) -> Option<usize>
Argmax/argmin (first-occurrence index) over an all-valid Float64 concat
output, folding chunks in place. BIT-IDENTICAL to running
f64_argmax_first_index/_min on the materialized buffer: that routine
keeps an 8-lane running extreme where lane = position % 8, so iterating
the chunks in 0..n order and updating lane[pos % 8] reproduces the exact
same per-lane state, and the identical cross-lane reduction (max value,
smallest index on ties = first occurrence) yields the same index — without
materializing the cold buffer. None for empty/non-chunked.
Sourcepub fn sum(&self) -> Scalar
pub fn sum(&self) -> Scalar
Matches pd.Series.sum() in skipna=True mode via fp-types::nansum.
Empty column returns 0.0 (matching pandas).
Sourcepub fn mean(&self) -> Scalar
pub fn mean(&self) -> Scalar
Arithmetic mean of non-missing values.
Matches pd.Series.mean() via fp-types::nanmean. Empty column
returns Null(NaN).
Sourcepub fn weighted_mean(&self, weights: &Self) -> Scalar
pub fn weighted_mean(&self, weights: &Self) -> Scalar
Weighted average of non-missing values.
Matches np.average(a, weights=w). Returns NaN if weights sum to zero.
Sourcepub fn average(&self, weights: &Self) -> Scalar
pub fn average(&self, weights: &Self) -> Scalar
Alias for weighted_mean, matching np.average naming.
Sourcepub fn min(&self) -> Scalar
pub fn min(&self) -> Scalar
Minimum non-missing value.
Matches pd.Series.min() via fp-types::nanmin. Preserves dtype
for homogeneous inputs.
Sourcepub fn max(&self) -> Scalar
pub fn max(&self) -> Scalar
Maximum non-missing value.
Matches pd.Series.max() via fp-types::nanmax.
pub fn median(&self) -> Scalar
Sourcepub fn prod(&self) -> Scalar
pub fn prod(&self) -> Scalar
Product of non-missing values.
Matches pd.Series.prod() via fp-types::nanprod. Empty column
returns 1.0 (matching pandas).
Sourcepub fn sum_skipna(&self, skipna: bool) -> Scalar
pub fn sum_skipna(&self, skipna: bool) -> Scalar
Sum with explicit pandas skipna= control.
Matches pd.Series.sum(skipna=...).
Sourcepub fn mean_skipna(&self, skipna: bool) -> Scalar
pub fn mean_skipna(&self, skipna: bool) -> Scalar
Mean with explicit pandas skipna= control.
Sourcepub fn min_skipna(&self, skipna: bool) -> Scalar
pub fn min_skipna(&self, skipna: bool) -> Scalar
Minimum with explicit pandas skipna= control.
Sourcepub fn max_skipna(&self, skipna: bool) -> Scalar
pub fn max_skipna(&self, skipna: bool) -> Scalar
Maximum with explicit pandas skipna= control.
Sourcepub fn median_skipna(&self, skipna: bool) -> Scalar
pub fn median_skipna(&self, skipna: bool) -> Scalar
Median with explicit pandas skipna= control.
Sourcepub fn prod_skipna(&self, skipna: bool) -> Scalar
pub fn prod_skipna(&self, skipna: bool) -> Scalar
Product with explicit pandas skipna= control.
Sourcepub fn var_skipna(&self, ddof: usize, skipna: bool) -> Scalar
pub fn var_skipna(&self, ddof: usize, skipna: bool) -> Scalar
Variance with explicit pandas skipna= control.
Sourcepub fn std_skipna(&self, ddof: usize, skipna: bool) -> Scalar
pub fn std_skipna(&self, ddof: usize, skipna: bool) -> Scalar
Standard deviation with explicit pandas skipna= control.
Sourcepub fn sem_skipna(&self, ddof: usize, skipna: bool) -> Scalar
pub fn sem_skipna(&self, ddof: usize, skipna: bool) -> Scalar
Standard error of the mean with explicit pandas skipna= control.
Sourcepub fn ffill(&self, limit: Option<usize>) -> Result<Self, ColumnError>
pub fn ffill(&self, limit: Option<usize>) -> Result<Self, ColumnError>
Forward-fill missing values with the most recent non-missing
value, optionally capped by limit consecutive fills.
Matches pd.Series.ffill(limit=None). Leading nulls stay null
until the first non-missing value is seen. limit=None means
unbounded; limit=Some(k) caps each missing run to k fills.
Sourcepub fn pad(&self, limit: Option<usize>) -> Result<Self, ColumnError>
pub fn pad(&self, limit: Option<usize>) -> Result<Self, ColumnError>
Alias for ffill, matching deprecated pd.Series.pad().
Sourcepub fn bfill(&self, limit: Option<usize>) -> Result<Self, ColumnError>
pub fn bfill(&self, limit: Option<usize>) -> Result<Self, ColumnError>
Backward-fill missing values with the next non-missing value,
optionally capped by limit consecutive fills.
Matches pd.Series.bfill(limit=None). Trailing nulls stay null
if no subsequent non-missing value is observed.
Sourcepub fn backfill(&self, limit: Option<usize>) -> Result<Self, ColumnError>
pub fn backfill(&self, limit: Option<usize>) -> Result<Self, ColumnError>
Alias for bfill, matching deprecated pd.Series.backfill().
Sourcepub fn nunique(&self) -> Scalar
pub fn nunique(&self) -> Scalar
Count of distinct non-missing values.
Matches pd.Series.nunique(dropna=True).
Sourcepub fn nunique_with_dropna(&self, dropna: bool) -> Scalar
pub fn nunique_with_dropna(&self, dropna: bool) -> Scalar
Count of distinct values with explicit missing-value handling.
Matches pd.Series.nunique(dropna=...). When dropna=false,
all missing values contribute a single extra distinct bucket.
Sourcepub fn any(&self) -> Scalar
pub fn any(&self) -> Scalar
Truthiness reduction: whether any non-missing value is truthy.
Matches pd.Series.any() in skipna=True mode. Empty column
returns false (pandas convention).
Sourcepub fn all(&self) -> Scalar
pub fn all(&self) -> Scalar
Truthiness reduction: whether all non-missing values are truthy.
Matches pd.Series.all() in skipna=True mode. Empty column
returns true.
Sourcepub fn diff_valid(&self) -> Result<Self, ColumnError>
pub fn diff_valid(&self) -> Result<Self, ColumnError>
Element-wise difference between consecutive non-missing values.
Unlike diff(1) — which inserts Null(NaN) for every missing
input — this walker-style helper skips nulls when picking the
“previous” value. Positions whose nearest preceding non-missing
neighbor lies before the start of the column (i.e. the first
non-missing value itself, or a missing input) emit Null(NaN).
Matches the common pandas idiom s.dropna().diff().reindex(s.index).
Sourcepub fn sample(&self, n: usize, seed: u64) -> Result<Self, ColumnError>
pub fn sample(&self, n: usize, seed: u64) -> Result<Self, ColumnError>
Deterministic uniform sampling of n rows with a caller-supplied
seed.
Matches the no-replacement subset of pd.Series.sample(n, random_state=seed). n >= len() returns a clone. Uses an
in-place partial Fisher-Yates shuffle driven by a stateless
LCG so callers can reproduce samples without dragging in
rand. Result dtype matches self.
Sourcepub fn first_valid(&self) -> Option<usize>
pub fn first_valid(&self) -> Option<usize>
Position of the first non-missing value, or None when every value is missing.
Matches pd.Series.first_valid_index() for positional
indices — callers can map the returned position through their
own Index to recover a label.
Sourcepub fn first_valid_index(&self) -> Option<usize>
pub fn first_valid_index(&self) -> Option<usize>
Alias for first_valid, matching
pd.Series.first_valid_index() for positional indices.
Sourcepub fn last_valid(&self) -> Option<usize>
pub fn last_valid(&self) -> Option<usize>
Position of the last non-missing value, or None when every value is missing.
Matches pd.Series.last_valid_index() for positional indices.
Sourcepub fn last_valid_index(&self) -> Option<usize>
pub fn last_valid_index(&self) -> Option<usize>
Alias for last_valid, matching
pd.Series.last_valid_index() for positional indices.
Sourcepub fn rolling_window_sum(
&self,
window: usize,
min_periods: usize,
) -> Result<Self, ColumnError>
pub fn rolling_window_sum( &self, window: usize, min_periods: usize, ) -> Result<Self, ColumnError>
Sliding-window sum over window consecutive positions.
Matches pd.Series.rolling(window).sum(). Positions with fewer
than min_periods non-missing values in the window emit
Null(NaN). min_periods=0 preserves pandas’ convention that
an empty window sums to 0.0. Result dtype is always Float64.
window=0 returns an all-null Float64 column the same length
as self.
Sourcepub fn isnull(&self) -> Result<Self, ColumnError>
pub fn isnull(&self) -> Result<Self, ColumnError>
Per-row missing-value flag (Bool column).
Matches pd.Series.isna() / isnull().
Sourcepub fn isna(&self) -> Result<Self, ColumnError>
pub fn isna(&self) -> Result<Self, ColumnError>
Alias for isnull, matching pd.Series.isna().
Sourcepub fn notnull(&self) -> Result<Self, ColumnError>
pub fn notnull(&self) -> Result<Self, ColumnError>
Per-row non-missing flag (Bool column).
Matches pd.Series.notna() / notnull().
Sourcepub fn notna(&self) -> Result<Self, ColumnError>
pub fn notna(&self) -> Result<Self, ColumnError>
Alias for notnull, matching pd.Series.notna().
Sourcepub fn isfinite(&self) -> Result<Self, ColumnError>
pub fn isfinite(&self) -> Result<Self, ColumnError>
Per-row check for finite values (not NaN or infinity).
Sourcepub fn isinf(&self) -> Result<Self, ColumnError>
pub fn isinf(&self) -> Result<Self, ColumnError>
Per-row check for infinite values.
Sourcepub fn isnan(&self) -> Result<Self, ColumnError>
pub fn isnan(&self) -> Result<Self, ColumnError>
Per-row check for NaN values.
Sourcepub fn pandas_reductions<R>(
&self,
reduce: impl FnOnce(&PandasReductions<'_>) -> R,
) -> Option<R>
pub fn pandas_reductions<R>( &self, reduce: impl FnOnce(&PandasReductions<'_>) -> R, ) -> Option<R>
This column as pandas’ float reductions read it
(fp_types::PandasReductions: its values, which slots are present,
and how pandas holds the missing ones), handed to reduce; None for a
dtype they do not cover (temporal, text, object). Typed and chunked
storage is read in place; a NaN in a float buffer is missing, as pandas
reads it (br-frankenpandas-9iim6).
Sourcepub fn var(&self, ddof: usize) -> Scalar
pub fn var(&self, ddof: usize) -> Scalar
Sample variance (ddof-parameterized).
Matches pd.Series.var(ddof=1): pandas’ nanvar (a masked dtype’s
numpy var), its sums in numpy’s order (br-frankenpandas-9iim6).
Sourcepub fn std(&self, ddof: usize) -> Scalar
pub fn std(&self, ddof: usize) -> Scalar
Sample standard deviation (ddof-parameterized).
Matches pd.Series.std(ddof=1).
Sourcepub fn sem(&self, ddof: usize) -> Scalar
pub fn sem(&self, ddof: usize) -> Scalar
Standard error of the mean (ddof-parameterized).
Matches pd.Series.sem(ddof=1).
Sourcepub fn cov(&self, other: &Self) -> Scalar
pub fn cov(&self, other: &Self) -> Scalar
Sample covariance between this column and another.
Matches pd.Series.cov(other). Uses ddof=1 by default.
Returns NaN if fewer than 2 valid pairs.
Sourcepub fn cov_ddof(&self, other: &Self, ddof: usize) -> Scalar
pub fn cov_ddof(&self, other: &Self, ddof: usize) -> Scalar
Sample covariance with custom ddof.
Sourcepub fn corr(&self, other: &Self) -> Scalar
pub fn corr(&self, other: &Self) -> Scalar
Pearson correlation coefficient between this column and another.
Matches pd.Series.corr(other). Returns NaN if fewer than 2 valid pairs.
Sourcepub fn autocorr(&self, lag: usize) -> Scalar
pub fn autocorr(&self, lag: usize) -> Scalar
Autocorrelation at a given lag.
Matches pd.Series.autocorr(lag). Returns NaN if fewer than 2 valid pairs.
pub fn skew(&self) -> Scalar
Sourcepub fn kurt(&self) -> Scalar
pub fn kurt(&self) -> Scalar
Excess sample kurtosis (Fisher’s definition, bias-corrected).
Matches pd.Series.kurt(). Requires at least 4 non-missing
values; returns Null(NaN) otherwise.
Sourcepub fn ptp(&self) -> Scalar
pub fn ptp(&self) -> Scalar
Peak-to-peak range (max − min) over non-missing values.
Matches np.ptp. Returns Null(NaN) for empty or all-missing
columns.
Sourcepub fn is_unique(&self) -> bool
pub fn is_unique(&self) -> bool
Whether every non-missing value is distinct.
Matches pd.Series.is_unique.
Sourcepub fn has_duplicates(&self) -> bool
pub fn has_duplicates(&self) -> bool
Whether any non-missing value repeats.
⚠️ pd.Series.has_duplicates does NOT exist (measured 2.2.3:
AttributeError) – it is an Index property. The pandas spelling for
values is s.duplicated().any(). FP superset, not parity.
Sourcepub fn pct_change(&self, periods: i64) -> Result<Self, ColumnError>
pub fn pct_change(&self, periods: i64) -> Result<Self, ColumnError>
Percent change between consecutive non-missing values.
Matches pd.Series.pct_change(periods=1) (fill_method defaults
to None on pandas 2.2+, so nulls propagate without forward fill).
Result dtype Float64. Non-numeric inputs return TypeError. The
leading |periods| positions are Null(NaN).
Sourcepub fn pct_change_with_fill(
&self,
periods: i64,
fill_method: Option<&str>,
limit: Option<usize>,
) -> Result<Self, ColumnError>
pub fn pct_change_with_fill( &self, periods: i64, fill_method: Option<&str>, limit: Option<usize>, ) -> Result<Self, ColumnError>
Percentage change with optional null fill before computation.
Matches pd.Series.pct_change(periods, fill_method=..., limit=...).
fill_method=None preserves pandas 2.2 default behavior (no fill).
"ffill" / "pad" forward-fill missing values first, while
"bfill" / "backfill" backward-fill first. limit caps
consecutive fills and is ignored when fill_method is None.
Sourcepub fn describe(&self) -> Result<Vec<(&'static str, Scalar)>, ColumnError>
pub fn describe(&self) -> Result<Vec<(&'static str, Scalar)>, ColumnError>
Summary descriptive statistics.
Matches pd.Series.describe() for numeric columns: returns the
seven-value tuple (count, mean, std, min, q25, q50, q75, max)
as a Vec<(&'static str, Scalar)> in pandas order. Non-numeric
columns return TypeError. Empty or fully-missing columns
produce Null(NaN) for the moment-based stats and Int64(0) for
count.
Sourcepub fn combine<F>(
&self,
other: &Self,
func: F,
fill: Option<Scalar>,
) -> Result<Self, ColumnError>
pub fn combine<F>( &self, other: &Self, func: F, fill: Option<Scalar>, ) -> Result<Self, ColumnError>
Combine two columns element-wise via func, using fill where
either input is missing.
Matches pd.Series.combine(other, func, fill_value=...). Result
length is the min of the two inputs (pandas aligns by position
when inputs are the same length; longer inputs are truncated).
Length mismatch returns LengthMismatch.
Sourcepub fn apply_float<F>(&self, func: F) -> Result<Self, ColumnError>
pub fn apply_float<F>(&self, func: F) -> Result<Self, ColumnError>
Numeric-only map that converts each non-missing value to f64,
applies func, and collects the result.
Matches the common pattern pd.Series.apply(lambda x: f(x))
for numeric-only transforms. Missing values pass through as
Null(NaN) without invoking func. Non-numeric inputs return a
type error on the first failing element. Result dtype is
Float64.
Sourcepub fn hist_counts(&self, bins: usize) -> Vec<usize>
pub fn hist_counts(&self, bins: usize) -> Vec<usize>
Bin non-missing values into bins equal-width buckets covering
[min, max] and return the count per bin.
Matches the bins=n histogram path behind pd.Series.hist (or
numpy.histogram(bins=n)[0]). Bucket boundaries are inclusive on
the low side except for the final bucket, which is inclusive on
both sides. Empty columns / bins=0 yield an empty Vec.
Sourcepub fn argmin(&self) -> Option<usize>
pub fn argmin(&self) -> Option<usize>
Position of the smallest non-missing value, or None when every value is missing.
Matches pd.Series.argmin() (skipna=True). Ties resolve to the
first position seen.
Sourcepub fn idxmin(&self) -> Option<usize>
pub fn idxmin(&self) -> Option<usize>
Alias for argmin, matching pd.Series.idxmin()
for positional indices.
Sourcepub fn argmax(&self) -> Option<usize>
pub fn argmax(&self) -> Option<usize>
Position of the largest non-missing value, or None when every value is missing.
Matches pd.Series.argmax().
Sourcepub fn idxmax(&self) -> Option<usize>
pub fn idxmax(&self) -> Option<usize>
Alias for argmax, matching pd.Series.idxmax()
for positional indices.
Sourcepub fn is_monotonic_increasing(&self) -> bool
pub fn is_monotonic_increasing(&self) -> bool
Whether non-missing values are non-decreasing.
Matches pd.Series.is_monotonic_increasing. An empty column or
a column with a single non-missing value returns true. Missing
values are skipped when comparing neighbors.
Sourcepub fn is_monotonic_decreasing(&self) -> bool
pub fn is_monotonic_decreasing(&self) -> bool
Whether non-missing values are non-increasing.
Matches pd.Series.is_monotonic_decreasing.
Sourcepub fn combine_first(&self, other: &Self) -> Result<Self, ColumnError>
pub fn combine_first(&self, other: &Self) -> Result<Self, ColumnError>
Combine two columns, taking self where present and other
otherwise.
Matches pd.Series.combine_first(other). For each aligned
position, the result is self when self is non-missing, else
other. Length mismatch returns LengthMismatch. Result
dtype follows self.
Sourcepub fn clip_lower(&self, lower: f64) -> Result<Self, ColumnError>
pub fn clip_lower(&self, lower: f64) -> Result<Self, ColumnError>
Clip values below lower, leaving the upper bound free.
Matches pd.Series.clip(lower=...). Thin wrapper over
clip(Some(lower), None) that preserves the shortcut reading
convention of pandas.
Sourcepub fn clip_upper(&self, upper: f64) -> Result<Self, ColumnError>
pub fn clip_upper(&self, upper: f64) -> Result<Self, ColumnError>
Clip values above upper, leaving the lower bound free.
Matches pd.Series.clip(upper=...).
Sourcepub fn drop_duplicates(&self) -> Result<Self, ColumnError>
pub fn drop_duplicates(&self) -> Result<Self, ColumnError>
Remove duplicated values, keeping the first occurrence.
Matches pd.Series.drop_duplicates(keep='first').
Sourcepub fn drop_duplicates_keep(&self, keep: &str) -> Result<Self, ColumnError>
pub fn drop_duplicates_keep(&self, keep: &str) -> Result<Self, ColumnError>
Remove duplicated values with explicit pandas keep= semantics.
Supported policies are "first", "last", and "false" /
"none" for pandas keep=False.
Sourcepub fn compare(&self, other: &Self) -> Result<(Self, Self), ColumnError>
pub fn compare(&self, other: &Self) -> Result<(Self, Self), ColumnError>
Element-wise comparison against other, emitting a 2-column
report of differences.
Matches pd.Series.compare(other) — returns two Columns
(self_values, other_values) containing only the positions
where the two differ. Missing entries compare equal to each
other. Length-mismatched inputs return LengthMismatch.
Sourcepub fn map<F>(&self, func: F) -> Result<Self, ColumnError>
pub fn map<F>(&self, func: F) -> Result<Self, ColumnError>
Apply a unary function over each value.
Matches pd.Series.map(func). Missing values are passed to the
user function (callers can decide whether to propagate NaN);
result dtype is inferred via infer_dtype over the outputs,
falling back to self.dtype when inference fails (e.g. empty
or all-null output).
Sourcepub fn interpolate_linear(&self) -> Result<Self, ColumnError>
pub fn interpolate_linear(&self) -> Result<Self, ColumnError>
Linearly interpolate missing numeric values.
Matches pd.Series.interpolate(method='linear') with the
default limit_direction='forward': interior missing runs are
linearly interpolated, LEADING nulls stay null (forward fill
cannot reach them), and TRAILING nulls are forward-filled with
the last valid value (pandas does not extrapolate). Non-numeric
columns return a type error. Result dtype is always Float64.
Sourcepub fn interpolate(&self) -> Result<Self, ColumnError>
pub fn interpolate(&self) -> Result<Self, ColumnError>
Alias for interpolate_linear, matching
the default pd.Series.interpolate() behavior.
pub fn quantile(&self, q: f64) -> Scalar
Sourcepub fn percentile(&self, p: f64) -> Scalar
pub fn percentile(&self, p: f64) -> Scalar
Percentile of non-missing values.
Matches np.percentile(). Takes percentile p in [0, 100].
Sourcepub fn nanquantile(&self, q: f64) -> Scalar
pub fn nanquantile(&self, q: f64) -> Scalar
Alias for quantile, matching np.nanquantile.
Sourcepub fn nanpercentile(&self, p: f64) -> Scalar
pub fn nanpercentile(&self, p: f64) -> Scalar
Alias for percentile, matching np.nanpercentile.
Sourcepub fn mode(&self) -> Result<Self, ColumnError>
pub fn mode(&self) -> Result<Self, ColumnError>
Most frequent non-missing values, ascending-sorted.
Matches pd.Series.mode(). Ties are all returned; missing
values are ignored. For empty or all-missing columns the
result is an empty same-dtype column.
Sourcepub fn memory_usage(&self, deep: bool) -> usize
pub fn memory_usage(&self, deep: bool) -> usize
Approximate memory footprint in bytes.
Matches pd.Series.memory_usage(deep=...). When deep is true
and the column contains Utf8 values, each string’s byte length
is counted; otherwise a fixed per-element width is used
(8 bytes for numeric/timedelta, 1 for Bool, pointer-sized for
Utf8, 0 for Null). The ValidityMask is counted separately.
Sourcepub fn itemsize(&self) -> usize
pub fn itemsize(&self) -> usize
Return the size in bytes of a single element.
Matches pd.Series.dtype.itemsize. Returns 8 for Int64/Float64/Datetime64/Timedelta64,
1 for Bool, and an estimate for variable-length types.
Sourcepub fn equals(&self, other: &Self) -> Result<Self, ColumnError>
pub fn equals(&self, other: &Self) -> Result<Self, ColumnError>
Element-wise equality into a Bool column.
Matches pd.Series.eq(other). Both inputs must have the same
length. Missing-on-either-side positions produce false
(pandas semantics: NaN != anything, including NaN).
Sourcepub fn dot(&self, other: &Self) -> Result<f64, ColumnError>
pub fn dot(&self, other: &Self) -> Result<f64, ColumnError>
Scalar dot product against another column.
Matches pd.Series.dot(other) for numeric columns. Missing
entries on either side contribute zero (consistent with
fp-types nan-aware sums). Length mismatch returns
LengthMismatch; non-numeric inputs return a type error on
the first offending value.
Sourcepub fn convolve(&self, kernel: &Self, mode: &str) -> Result<Self, ColumnError>
pub fn convolve(&self, kernel: &Self, mode: &str) -> Result<Self, ColumnError>
Discrete linear convolution of two 1D sequences.
Matches np.convolve(a, v, mode). Modes:
- “full”: output length = len(a) + len(v) - 1
- “same”: output length = max(len(a), len(v))
- “valid”: output length = max(len(a), len(v)) - min(len(a), len(v)) + 1
Sourcepub fn correlate(&self, other: &Self, mode: &str) -> Result<Self, ColumnError>
pub fn correlate(&self, other: &Self, mode: &str) -> Result<Self, ColumnError>
Cross-correlation of two 1D sequences.
Matches np.correlate(a, v, mode). This is convolve(a, reverse(v), mode).
Sourcepub fn fillna_with_column(&self, other: &Self) -> Result<Self, ColumnError>
pub fn fillna_with_column(&self, other: &Self) -> Result<Self, ColumnError>
Fill missing values in self with aligned values from other.
Matches pd.Series.fillna(other) when other is a Series. Only
positions missing in self are replaced. Length mismatch
returns LengthMismatch. Values from other are cast into
self.dtype.
Sourcepub fn divmod(&self, divisor: &Self) -> Result<(Self, Self), ColumnError>
pub fn divmod(&self, divisor: &Self) -> Result<(Self, Self), ColumnError>
Element-wise quotient and remainder against divisor.
Matches pd.Series.divmod(other): returns
(self // other, self % other). Division by zero, missing
inputs, or non-numeric values yield Null(NaN) in both
outputs at that position. Length mismatch returns
LengthMismatch. Both result columns are Float64.
Sourcepub fn where_cond_series(
&self,
cond: &Self,
other: &Self,
) -> Result<Self, ColumnError>
pub fn where_cond_series( &self, cond: &Self, other: &Self, ) -> Result<Self, ColumnError>
Keep values where cond is true; replace false positions with
values from an other Column (element-wise).
Matches pd.Series.where(cond, other) when other is a Series
aligned by position. All three inputs must have the same
length. Cond must be Bool. Missing cond entries propagate as
Null(NaN). The result dtype is self.dtype; if other’s dtype
differs, values coming from other are cast via cast_scalar.
Sourcepub fn mask_series(
&self,
cond: &Self,
other: &Self,
) -> Result<Self, ColumnError>
pub fn mask_series( &self, cond: &Self, other: &Self, ) -> Result<Self, ColumnError>
Replace values where cond is true with values from other
(element-wise); otherwise keep.
Matches pd.Series.mask(cond, other) when other is a Series.
Sourcepub fn replace_values(
&self,
to_replace: &[Scalar],
replacement: &[Scalar],
) -> Result<Self, ColumnError>
pub fn replace_values( &self, to_replace: &[Scalar], replacement: &[Scalar], ) -> Result<Self, ColumnError>
Pairwise value substitution.
Matches pd.Series.replace(to_replace, value) when both
arguments are scalar lists of equal length. For each value in
the column, the first (to_replace, replacement) pair that
matches via Scalar::semantic_eq is applied. Missing inputs
can be replaced by listing Scalar::Null(...) in to_replace.
Length mismatch between to_replace and values returns
ColumnError::LengthMismatch.
Sourcepub fn replace(
&self,
to_replace: &[Scalar],
replacement: &[Scalar],
) -> Result<Self, ColumnError>
pub fn replace( &self, to_replace: &[Scalar], replacement: &[Scalar], ) -> Result<Self, ColumnError>
Alias for replace_values, matching
pd.Series.replace(to_replace, value) for equal-length scalar
list replacements.
Sourcepub fn nonzero(&self) -> Vec<usize>
pub fn nonzero(&self) -> Vec<usize>
Positions where the value is truthy and non-missing.
Matches np.nonzero / pd.Series.to_numpy().nonzero() style
behavior. Useful for turning a Bool mask column into explicit
index positions. Non-missing zero-like values (Int64 0,
Float64 0.0, Bool false, empty Utf8) are excluded.
Sourcepub fn count_nonzero(&self) -> usize
pub fn count_nonzero(&self) -> usize
Count number of non-zero elements.
Matches np.count_nonzero().
Sourcepub fn flatnonzero(&self) -> Result<Self, ColumnError>
pub fn flatnonzero(&self) -> Result<Self, ColumnError>
Indices of non-zero elements as a column.
Matches np.flatnonzero(). Returns Int64 column of indices.
Sourcepub fn where_cond(
&self,
cond: &Self,
other: &Scalar,
) -> Result<Self, ColumnError>
pub fn where_cond( &self, cond: &Self, other: &Scalar, ) -> Result<Self, ColumnError>
Keep values where cond is true; replace false positions with
other.
Matches pd.Series.where(cond, other). cond must be a Bool
column of the same length (otherwise LengthMismatch). Missing
positions in cond propagate as Null(NaN) in the result.
Sourcepub fn where(&self, cond: &Self, other: &Scalar) -> Result<Self, ColumnError>
pub fn where(&self, cond: &Self, other: &Scalar) -> Result<Self, ColumnError>
Alias for where_cond, matching
pd.Series.where(cond, other) for scalar other values.
Sourcepub fn rank(&self, method: &str, ascending: bool) -> Result<Self, ColumnError>
pub fn rank(&self, method: &str, ascending: bool) -> Result<Self, ColumnError>
Rank the values of the column.
Matches pd.Series.rank(method=..., ascending=..., na_option='keep').
Supported method values are "average" (pandas default,
ties → average of tied ranks), "min" (ties → smallest tied
rank), "max" (ties → largest tied rank), "first" (ties →
appearance order), and "dense" (ties → consecutive integers
with no gaps between distinct groups).
Missing input positions stay missing in the output (matching
pandas na_option='keep'). The result dtype is always Float64
so "average" can produce non-integer ranks.
Sourcepub fn searchsorted(
&self,
needle: &Scalar,
side: &str,
) -> Result<usize, ColumnError>
pub fn searchsorted( &self, needle: &Scalar, side: &str, ) -> Result<usize, ColumnError>
Position where needle would be inserted to preserve sort order.
Matches pd.Series.searchsorted(value, side). side is
"left" (first valid insertion position) or "right" (last).
The column is assumed sorted ascending with missing values at
the end (consistent with sort_values(true)). Missing
needle is rejected with a type error.
Sourcepub fn searchsorted_with_sorter(
&self,
needle: &Scalar,
side: &str,
sorter: &[usize],
) -> Result<usize, ColumnError>
pub fn searchsorted_with_sorter( &self, needle: &Scalar, side: &str, sorter: &[usize], ) -> Result<usize, ColumnError>
Position where needle would be inserted using an explicit sorter.
Matches pd.Series.searchsorted(value, side, sorter=...) where
sorter is a permutation that sorts the column ascending.
Sourcepub fn searchsorted_values(
&self,
needles: &[Scalar],
side: &str,
) -> Result<Self, ColumnError>
pub fn searchsorted_values( &self, needles: &[Scalar], side: &str, ) -> Result<Self, ColumnError>
Positions where needles would be inserted to preserve sort order.
Matches pd.Series.searchsorted(values, side) for array-like
inputs. Returns an Int64 column of insertion positions.
Missing needles are rejected with the same error as the scalar path.
Sourcepub fn searchsorted_values_with_sorter(
&self,
needles: &[Scalar],
side: &str,
sorter: &[usize],
) -> Result<Self, ColumnError>
pub fn searchsorted_values_with_sorter( &self, needles: &[Scalar], side: &str, sorter: &[usize], ) -> Result<Self, ColumnError>
Positions where needles would be inserted using an explicit sorter.
Matches pd.Series.searchsorted(values, side, sorter=...) for
array-like inputs. Returns an Int64 column of insertion positions.
Sourcepub fn digitize(&self, bins: &Self, right: bool) -> Result<Self, ColumnError>
pub fn digitize(&self, bins: &Self, right: bool) -> Result<Self, ColumnError>
Return bin indices for values given sorted bin edges.
Matches np.digitize(). Returns indices such that bins[i-1] <= x < bins[i].
Sourcepub fn bincount(&self, minlength: usize) -> Result<Self, ColumnError>
pub fn bincount(&self, minlength: usize) -> Result<Self, ColumnError>
Count occurrences of each non-negative integer value.
Matches np.bincount(). Returns array where output[i] = count of i in input.
Requires non-negative Int64 values.
Sourcepub fn histogram(&self, bin_edges: &[f64]) -> Result<Self, ColumnError>
pub fn histogram(&self, bin_edges: &[f64]) -> Result<Self, ColumnError>
Compute histogram using provided bin edges.
Matches np.histogram(a, bins=edges). Returns counts for each bin.
Bins are [edges[i], edges[i+1]) except the last which is [edges[n-1], edges[n]].
Sourcepub fn histogram_auto(
&self,
n_bins: usize,
) -> Result<(Self, Vec<f64>), ColumnError>
pub fn histogram_auto( &self, n_bins: usize, ) -> Result<(Self, Vec<f64>), ColumnError>
Compute histogram with auto-generated bins.
Matches np.histogram(a, bins=n_bins). Returns (counts, bin_edges). Bins are evenly spaced between min and max of the data.
Sourcepub fn holds_non_text(&self) -> bool
pub fn holds_non_text(&self) -> bool
Whether this object (Utf8) column holds a present value that is not
a string - an int of a mixed column, a list or host cell (fvsao.33).
A text fast path that reads the column as &strs must decline such a
column: it would read those cells as “” (fvsao.66).
Sourcepub fn astype(&self, target: DType) -> Result<Self, ColumnError>
pub fn astype(&self, target: DType) -> Result<Self, ColumnError>
Cast the column to a target dtype.
Matches pd.Series.astype(dtype). Each value is routed through
fp_types::cast_scalar, so coercion rules (Int64↔Float64,
Bool→Int64, Utf8 parsing, etc.) match the existing cast table.
Cast failures on any element return ColumnError::Type wrapping
the underlying TypeError so the caller can attribute the
failing conversion. Missing values pass through as the
target dtype’s canonical missing representation.
Sourcepub fn nsmallest_keep(&self, n: usize, keep: &str) -> Result<Self, ColumnError>
pub fn nsmallest_keep(&self, n: usize, keep: &str) -> Result<Self, ColumnError>
Return the n smallest values with explicit keep policy for
ties.
Matches pd.Series.nsmallest(n, keep=...):
"first": take the firstnrows in ascending order, break ties by original position (stable)."last": on ties, prefer later-appearing rows."all": include every row tied with then-th smallest, so the returned column can exceedn.
Sourcepub fn nlargest_keep(&self, n: usize, keep: &str) -> Result<Self, ColumnError>
pub fn nlargest_keep(&self, n: usize, keep: &str) -> Result<Self, ColumnError>
Return the n largest values with explicit keep policy for
ties.
Matches pd.Series.nlargest(n, keep=...) — see nsmallest_keep
for the shared semantics.
Sourcepub fn nlargest(&self, n: usize) -> Result<Self, ColumnError>
pub fn nlargest(&self, n: usize) -> Result<Self, ColumnError>
Return the n largest values.
Matches pd.Series.nlargest(n) with keep='first' — ties are
broken by first-seen order via a stable descending sort.
Missing values are placed at the end of the sorted view and
therefore excluded from the top-n when n fits within the
non-missing count. n > len() clamps to the full column.
Sourcepub fn nsmallest(&self, n: usize) -> Result<Self, ColumnError>
pub fn nsmallest(&self, n: usize) -> Result<Self, ColumnError>
Return the n smallest values.
Matches pd.Series.nsmallest(n) with keep='first'.
Sourcepub fn mask(&self, cond: &Self, other: &Scalar) -> Result<Self, ColumnError>
pub fn mask(&self, cond: &Self, other: &Scalar) -> Result<Self, ColumnError>
Replace values where cond is true with other; otherwise keep.
Matches pd.Series.mask(cond, other) — the logical inverse of
where_cond. Same validation rules apply.
Sourcepub fn typed_radix_keys(&self, ascending: bool) -> Option<Vec<u64>>
pub fn typed_radix_keys(&self, ascending: bool) -> Option<Vec<u64>>
Order-preserving u64 radix keys for this column (per-column ascending/
descending baked in), for the multi-key lexsort
(radix_argsort_multi_u64, br-frankenpandas-lnsu6). Some only for an
all-valid Int64 or all-valid no-NaN Float64 column — the cases where
the radix order is bit-identical to the stable comparator: Int64 cmp,
finite-Float64 partial_cmp (-0.0 normalized to +0.0). A Float64
column with any NaN returns None so the caller keeps the Scalar
comparator (which, in the multi-key path, treats NaN as compare-Equal —
a semantics the monotonic radix key cannot reproduce).
pub fn sort_values(&self, ascending: bool) -> Result<Self, ColumnError>
Sourcepub fn argsort(&self) -> Vec<usize>
pub fn argsort(&self) -> Vec<usize>
Positions that would sort the column ascending.
Matches pd.Series.argsort(). Returns a Vec<usize> such that
take(&argsort) equals sort_values(true). Missing values
sort to the end; stable.
Sourcepub fn argsort_with(&self, ascending: bool) -> Vec<usize>
pub fn argsort_with(&self, ascending: bool) -> Vec<usize>
Stable sorting permutation in either direction. Uses the typed radix
fast path for all-valid Int64/Float64 columns (comparison-free) and the
Scalar na-last comparator otherwise. take(&argsort_with(asc)) equals
sort_values(asc). Missing values sort to the end regardless of asc.
Sourcepub fn argpartition(&self, kth: usize) -> Result<Vec<usize>, ColumnError>
pub fn argpartition(&self, kth: usize) -> Result<Vec<usize>, ColumnError>
Return indices that partition the array around kth element.
Matches np.argpartition(). After partition, element at kth position is in its sorted position, elements before are <= kth element, elements after are >= kth element.
Sourcepub fn partition(&self, kth: usize) -> Result<Self, ColumnError>
pub fn partition(&self, kth: usize) -> Result<Self, ColumnError>
Partition array around kth smallest element.
Matches np.partition(). Returns a partially sorted array where element at kth position is in its final sorted position.
Sourcepub fn diff(&self, periods: i64) -> Result<Self, ColumnError>
pub fn diff(&self, periods: i64) -> Result<Self, ColumnError>
First-order difference: values[i] - values[i - periods].
Matches pd.Series.diff(periods). The leading |periods|
positions are Null(NaN). Negative periods compute
values[i] - values[i + |periods|]. Non-numeric inputs return
a type error. Result dtype is always Float64.
Sourcepub fn ediff1d(
&self,
to_begin: Option<Scalar>,
to_end: Option<Scalar>,
) -> Result<Self, ColumnError>
pub fn ediff1d( &self, to_begin: Option<Scalar>, to_end: Option<Scalar>, ) -> Result<Self, ColumnError>
Consecutive differences with optional prepend/append values.
Matches np.ediff1d(). Prepend/append scalars are added at boundaries.
Sourcepub fn gradient(&self) -> Result<Self, ColumnError>
pub fn gradient(&self) -> Result<Self, ColumnError>
Numerical gradient using central differences.
Matches np.gradient() with uniform spacing.
Sourcepub fn trapz(&self, dx: f64) -> Result<Scalar, ColumnError>
pub fn trapz(&self, dx: f64) -> Result<Scalar, ColumnError>
Trapezoidal numerical integration.
Matches np.trapz(). Returns scalar result of integral.
Sourcepub fn duplicated(&self) -> Result<Self, ColumnError>
pub fn duplicated(&self) -> Result<Self, ColumnError>
Per-row boolean flag for duplicated values (keep=‘first’).
Matches pd.Series.duplicated() — all but the first occurrence
of each value is flagged true. Missing values are treated as a
single bucket (pandas equates NaN for this purpose).
Sourcepub fn duplicated_keep(&self, keep: &str) -> Result<Self, ColumnError>
pub fn duplicated_keep(&self, keep: &str) -> Result<Self, ColumnError>
Per-row boolean flag for duplicated values with explicit keep policy.
Matches pd.Series.duplicated(keep=...). Supported policies
are "first", "last", and "false" / "none" for pandas
keep=False.
Sourcepub fn between(
&self,
lower: f64,
upper: f64,
inclusive: bool,
) -> Result<Self, ColumnError>
pub fn between( &self, lower: f64, upper: f64, inclusive: bool, ) -> Result<Self, ColumnError>
Bool column indicating whether each value lies in [lower, upper]
(or the open interval when inclusive=false).
Matches pd.Series.between(left, right, inclusive='both'|'neither').
Missing values map to false. Non-numeric inputs return a type
error.
Sourcepub fn between_inclusive(
&self,
lower: f64,
upper: f64,
inclusive: &str,
) -> Result<Self, ColumnError>
pub fn between_inclusive( &self, lower: f64, upper: f64, inclusive: &str, ) -> Result<Self, ColumnError>
Bool column indicating whether each value lies between bounds with pandas string-valued side-inclusion semantics.
Matches pd.Series.between(inclusive=...) for "both",
"left", "right", and "neither".
Sourcepub fn factorize(&self) -> Result<(Self, Self), ColumnError>
pub fn factorize(&self) -> Result<(Self, Self), ColumnError>
Encode the column as integer codes plus unique values.
Matches pd.Series.factorize() default behavior: missing values
map to -1, and uniques preserve first-seen order.
Sourcepub fn factorize_with_options(
&self,
sort: bool,
use_na_sentinel: bool,
) -> Result<(Self, Self), ColumnError>
pub fn factorize_with_options( &self, sort: bool, use_na_sentinel: bool, ) -> Result<(Self, Self), ColumnError>
Encode the column as integer codes plus unique values.
Matches pd.Series.factorize(sort=..., use_na_sentinel=...).
When sort=true, uniques are sorted and codes are remapped to the
sorted positions. When use_na_sentinel=false, missing values are
emitted as a regular unique bucket instead of -1.
Sourcepub fn abs(&self) -> Result<Self, ColumnError>
pub fn abs(&self) -> Result<Self, ColumnError>
Element-wise absolute value.
Matches pd.Series.abs(). Int/Float/Bool/Timedelta paths preserve
dtype; Utf8 inputs return ColumnError::Type because pandas raises
TypeError on non-numeric .abs().
Sourcepub fn fabs(&self) -> Result<Self, ColumnError>
pub fn fabs(&self) -> Result<Self, ColumnError>
Alias for abs, matching np.fabs.
Sourcepub fn absolute(&self) -> Result<Self, ColumnError>
pub fn absolute(&self) -> Result<Self, ColumnError>
Alias for abs, matching np.absolute.
Sourcepub fn neg(&self) -> Result<Self, ColumnError>
pub fn neg(&self) -> Result<Self, ColumnError>
Negate numeric values. Matches numpy’s negative ufunc.
Sourcepub fn positive(&self) -> Result<Self, ColumnError>
pub fn positive(&self) -> Result<Self, ColumnError>
Unary positive (identity for numeric, error for non-numeric).
Sourcepub fn negative(&self) -> Result<Self, ColumnError>
pub fn negative(&self) -> Result<Self, ColumnError>
Alias for positive.
Sourcepub fn sqrt(&self) -> Result<Self, ColumnError>
pub fn sqrt(&self) -> Result<Self, ColumnError>
Square root of numeric values. Matches numpy’s sqrt ufunc.
Sourcepub fn exp(&self) -> Result<Self, ColumnError>
pub fn exp(&self) -> Result<Self, ColumnError>
Exponential (e^x) of numeric values. Matches numpy’s exp ufunc.
Sourcepub fn log(&self) -> Result<Self, ColumnError>
pub fn log(&self) -> Result<Self, ColumnError>
Natural logarithm of numeric values. Matches numpy’s log ufunc.
Sourcepub fn log10(&self) -> Result<Self, ColumnError>
pub fn log10(&self) -> Result<Self, ColumnError>
Base-10 logarithm of numeric values. Matches numpy’s log10 ufunc.
Sourcepub fn log2(&self) -> Result<Self, ColumnError>
pub fn log2(&self) -> Result<Self, ColumnError>
Base-2 logarithm of numeric values. Matches numpy’s log2 ufunc.
Sourcepub fn sin(&self) -> Result<Self, ColumnError>
pub fn sin(&self) -> Result<Self, ColumnError>
Compute element-wise sine.
Sourcepub fn cos(&self) -> Result<Self, ColumnError>
pub fn cos(&self) -> Result<Self, ColumnError>
Compute element-wise cosine.
Sourcepub fn tan(&self) -> Result<Self, ColumnError>
pub fn tan(&self) -> Result<Self, ColumnError>
Compute element-wise tangent.
Sourcepub fn asin(&self) -> Result<Self, ColumnError>
pub fn asin(&self) -> Result<Self, ColumnError>
Compute element-wise arcsine.
Sourcepub fn acos(&self) -> Result<Self, ColumnError>
pub fn acos(&self) -> Result<Self, ColumnError>
Compute element-wise arccosine.
Sourcepub fn atan(&self) -> Result<Self, ColumnError>
pub fn atan(&self) -> Result<Self, ColumnError>
Compute element-wise arctangent.
Sourcepub fn sinh(&self) -> Result<Self, ColumnError>
pub fn sinh(&self) -> Result<Self, ColumnError>
Compute element-wise hyperbolic sine.
Sourcepub fn cosh(&self) -> Result<Self, ColumnError>
pub fn cosh(&self) -> Result<Self, ColumnError>
Compute element-wise hyperbolic cosine.
Sourcepub fn tanh(&self) -> Result<Self, ColumnError>
pub fn tanh(&self) -> Result<Self, ColumnError>
Compute element-wise hyperbolic tangent.
Sourcepub fn asinh(&self) -> Result<Self, ColumnError>
pub fn asinh(&self) -> Result<Self, ColumnError>
Compute element-wise inverse hyperbolic sine.
Sourcepub fn acosh(&self) -> Result<Self, ColumnError>
pub fn acosh(&self) -> Result<Self, ColumnError>
Compute element-wise inverse hyperbolic cosine.
Sourcepub fn atanh(&self) -> Result<Self, ColumnError>
pub fn atanh(&self) -> Result<Self, ColumnError>
Compute element-wise inverse hyperbolic tangent.
Sourcepub fn arcsin(&self) -> Result<Self, ColumnError>
pub fn arcsin(&self) -> Result<Self, ColumnError>
Numpy-style alias for asin.
Matches np.arcsin(x).
Sourcepub fn arccos(&self) -> Result<Self, ColumnError>
pub fn arccos(&self) -> Result<Self, ColumnError>
Numpy-style alias for acos.
Matches np.arccos(x).
Sourcepub fn arctan(&self) -> Result<Self, ColumnError>
pub fn arctan(&self) -> Result<Self, ColumnError>
Numpy-style alias for atan.
Matches np.arctan(x).
Sourcepub fn arctan2(&self, other: &Self) -> Result<Self, ColumnError>
pub fn arctan2(&self, other: &Self) -> Result<Self, ColumnError>
Numpy-style alias for atan2.
Matches np.arctan2(y, x).
Sourcepub fn arcsinh(&self) -> Result<Self, ColumnError>
pub fn arcsinh(&self) -> Result<Self, ColumnError>
Numpy-style alias for asinh.
Matches np.arcsinh(x).
Sourcepub fn arccosh(&self) -> Result<Self, ColumnError>
pub fn arccosh(&self) -> Result<Self, ColumnError>
Numpy-style alias for acosh.
Matches np.arccosh(x).
Sourcepub fn arctanh(&self) -> Result<Self, ColumnError>
pub fn arctanh(&self) -> Result<Self, ColumnError>
Numpy-style alias for atanh.
Matches np.arctanh(x).
pub fn floor(&self) -> Result<Self, ColumnError>
Sourcepub fn ceil(&self) -> Result<Self, ColumnError>
pub fn ceil(&self) -> Result<Self, ColumnError>
Compute element-wise ceiling.
Sourcepub fn trunc(&self) -> Result<Self, ColumnError>
pub fn trunc(&self) -> Result<Self, ColumnError>
Compute element-wise truncation toward zero.
Sourcepub fn nan_to_num(&self) -> Result<Self, ColumnError>
pub fn nan_to_num(&self) -> Result<Self, ColumnError>
Replace NaN with zero and infinity with large finite numbers.
Matches np.nan_to_num(x). NaN becomes 0, positive infinity becomes a large positive number, negative infinity becomes a large negative number.
Sourcepub fn nan_to_num_with_values(
&self,
nan: f64,
posinf: f64,
neginf: f64,
) -> Result<Self, ColumnError>
pub fn nan_to_num_with_values( &self, nan: f64, posinf: f64, neginf: f64, ) -> Result<Self, ColumnError>
Replace NaN and infinity with specified values.
Matches np.nan_to_num(x, nan=nan, posinf=posinf, neginf=neginf).
Sourcepub fn rint(&self) -> Result<Self, ColumnError>
pub fn rint(&self) -> Result<Self, ColumnError>
Round to nearest even integer (banker’s rounding).
Matches np.rint(x). Values exactly halfway between integers round to the nearest even integer.
Sourcepub fn fix(&self) -> Result<Self, ColumnError>
pub fn fix(&self) -> Result<Self, ColumnError>
Round toward zero (same as trunc).
Matches np.fix(x). Alias for trunc().
Sourcepub fn trim_zeros(&self, trim: &str) -> Result<Self, ColumnError>
pub fn trim_zeros(&self, trim: &str) -> Result<Self, ColumnError>
Trim leading and/or trailing zeros from a 1-D array.
Matches np.trim_zeros(). The trim parameter specifies:
- “f” or “fb”: trim from front (leading zeros)
- “b” or “fb”: trim from back (trailing zeros)
- “fb” (default): trim both
Sourcepub fn around(&self, decimals: i32) -> Result<Self, ColumnError>
pub fn around(&self, decimals: i32) -> Result<Self, ColumnError>
Round to the given number of decimals.
Matches np.around(a, decimals). For negative decimals, rounds to the left of the decimal point (e.g., decimals=-1 rounds to tens).
Sourcepub fn unwrap(&self, discont: Option<f64>) -> Result<Self, ColumnError>
pub fn unwrap(&self, discont: Option<f64>) -> Result<Self, ColumnError>
Unwrap by changing deltas between values to their 2*pi complements.
Matches np.unwrap(). Unwraps radian phase values by adding multiples of 2*pi when the absolute difference from the previous value exceeds the discontinuity threshold (default: pi).
Sourcepub fn expm1(&self) -> Result<Self, ColumnError>
pub fn expm1(&self) -> Result<Self, ColumnError>
Compute exp(x) - 1 with improved precision for small x.
Sourcepub fn log1p(&self) -> Result<Self, ColumnError>
pub fn log1p(&self) -> Result<Self, ColumnError>
Compute ln(1 + x) with improved precision for small x.
Sourcepub fn cbrt(&self) -> Result<Self, ColumnError>
pub fn cbrt(&self) -> Result<Self, ColumnError>
Compute element-wise cube root.
Sourcepub fn ldexp(&self, exp: i32) -> Result<Self, ColumnError>
pub fn ldexp(&self, exp: i32) -> Result<Self, ColumnError>
Multiply by 2 raised to an integer power.
Matches np.ldexp(x, exp). Computes x * 2^exp for each element.
Sourcepub fn modf(&self) -> Result<(Self, Self), ColumnError>
pub fn modf(&self) -> Result<(Self, Self), ColumnError>
Split into integer and fractional parts.
Matches np.modf(x). Returns (fractional_part, integer_part) as two columns. The fractional part has the same sign as the input.
Sourcepub fn frexp(&self) -> Result<(Self, Self), ColumnError>
pub fn frexp(&self) -> Result<(Self, Self), ColumnError>
Decompose float into mantissa and exponent.
Matches np.frexp(x). Returns (mantissa, exponent) where:
- mantissa is in [0.5, 1.0) or exactly 0.0
- exponent is an integer
- x = mantissa * 2^exponent
pub fn nextafter(&self, other: &Self) -> Result<Self, ColumnError>
Sourcepub fn isneginf(&self) -> Result<Self, ColumnError>
pub fn isneginf(&self) -> Result<Self, ColumnError>
Check if values are negative infinity.
Matches np.isneginf(x). Returns a Bool column that is True where the value is negative infinity.
Sourcepub fn isposinf(&self) -> Result<Self, ColumnError>
pub fn isposinf(&self) -> Result<Self, ColumnError>
Check if values are positive infinity.
Matches np.isposinf(x). Returns a Bool column that is True where the value is positive infinity.
Sourcepub fn exp2(&self) -> Result<Self, ColumnError>
pub fn exp2(&self) -> Result<Self, ColumnError>
Compute 2 raised to the power of each element.
Matches np.exp2(x). Returns 2^x for each element.
Sourcepub fn sinc(&self) -> Result<Self, ColumnError>
pub fn sinc(&self) -> Result<Self, ColumnError>
Compute the sinc function.
Matches np.sinc(x). Returns sin(pix) / (pix), with sinc(0) = 1.
Sourcepub fn logaddexp(&self, other: &Self) -> Result<Self, ColumnError>
pub fn logaddexp(&self, other: &Self) -> Result<Self, ColumnError>
Compute log(exp(x) + exp(y)) in a numerically stable way.
Matches np.logaddexp(x, y). Useful for log-domain arithmetic where direct computation would overflow/underflow.
Sourcepub fn logaddexp2(&self, other: &Self) -> Result<Self, ColumnError>
pub fn logaddexp2(&self, other: &Self) -> Result<Self, ColumnError>
Compute log2(2x + 2y) in a numerically stable way.
Matches np.logaddexp2(x, y). Like logaddexp but using base 2.
Sourcepub fn spacing(&self) -> Result<Self, ColumnError>
pub fn spacing(&self) -> Result<Self, ColumnError>
Compute spacing between this value and the next representable float.
Matches np.spacing(x). Returns the ULP (unit in last place) - the distance to the next representable float away from zero.
Sourcepub fn radians(&self) -> Result<Self, ColumnError>
pub fn radians(&self) -> Result<Self, ColumnError>
Convert angles from degrees to radians.
Sourcepub fn deg2rad(&self) -> Result<Self, ColumnError>
pub fn deg2rad(&self) -> Result<Self, ColumnError>
Alias for radians.
Sourcepub fn degrees(&self) -> Result<Self, ColumnError>
pub fn degrees(&self) -> Result<Self, ColumnError>
Convert angles from radians to degrees.
Sourcepub fn rad2deg(&self) -> Result<Self, ColumnError>
pub fn rad2deg(&self) -> Result<Self, ColumnError>
Alias for degrees.
Sourcepub fn reciprocal(&self) -> Result<Self, ColumnError>
pub fn reciprocal(&self) -> Result<Self, ColumnError>
Compute element-wise reciprocal (1/x).
Sourcepub fn square(&self) -> Result<Self, ColumnError>
pub fn square(&self) -> Result<Self, ColumnError>
Compute element-wise square (x^2).
Sourcepub fn shift(&self, periods: i64, fill: Scalar) -> Result<Self, ColumnError>
pub fn shift(&self, periods: i64, fill: Scalar) -> Result<Self, ColumnError>
Shift column values by periods positions, filling vacated slots
with fill.
Matches pd.Series.shift(periods, fill_value) for the positional
form. Positive periods shift right (vacates the head); negative
periods shift left (vacates the tail).
Sourcepub fn clip(
&self,
lower: Option<f64>,
upper: Option<f64>,
) -> Result<Self, ColumnError>
pub fn clip( &self, lower: Option<f64>, upper: Option<f64>, ) -> Result<Self, ColumnError>
Clip numeric values to [lower, upper].
Matches pd.Series.clip(lower, upper). None on either bound
disables that side. Non-numeric inputs return a type error.
Missing values pass through unchanged. Result dtype is Float64
(via infer_dtype) to accommodate fractional clipping.
Sourcepub fn round(&self, decimals: i32) -> Result<Self, ColumnError>
pub fn round(&self, decimals: i32) -> Result<Self, ColumnError>
Round numeric values to decimals decimal places.
Matches pd.Series.round(decimals). Negative decimals rounds
to the left of the decimal point. Int columns pass through
unchanged for decimals >= 0 and retain Int64 dtype for negative
decimals. Bool columns pass through unchanged. Missing values are
preserved.
Sourcepub fn isin(&self, needles: &[Scalar]) -> Result<Self, ColumnError>
pub fn isin(&self, needles: &[Scalar]) -> Result<Self, ColumnError>
Per-row boolean membership test against needles.
Matches pd.Series.isin(values). The result is always a Bool
column the same length as self. Missing input positions map
to false (pandas convention — NaN is never “in” a set).
Sourcepub fn unique(&self) -> Result<Self, ColumnError>
pub fn unique(&self) -> Result<Self, ColumnError>
Unique values in first-seen order, missing values dropped.
Matches pd.Series.unique() (pandas returns values in order of
appearance and drops NaN/NA). Float NaN is deduplicated on bit
pattern; +0.0 / -0.0 fold to the same key.
Sourcepub fn setdiff1d(&self, other: &Self) -> Result<Self, ColumnError>
pub fn setdiff1d(&self, other: &Self) -> Result<Self, ColumnError>
Set difference: values in self that are not in other.
Matches np.setdiff1d().
Sourcepub fn intersect1d(&self, other: &Self) -> Result<Self, ColumnError>
pub fn intersect1d(&self, other: &Self) -> Result<Self, ColumnError>
Set intersection: values common to both columns.
Matches np.intersect1d().
Sourcepub fn union1d(&self, other: &Self) -> Result<Self, ColumnError>
pub fn union1d(&self, other: &Self) -> Result<Self, ColumnError>
Set union: unique values from both columns.
Matches np.union1d().
Sourcepub fn setxor1d(&self, other: &Self) -> Result<Self, ColumnError>
pub fn setxor1d(&self, other: &Self) -> Result<Self, ColumnError>
Set symmetric difference: unique values in either but not both.
Matches np.setxor1d(). Returns unique values that are in exactly one of the input arrays.
Sourcepub fn in1d(&self, other: &Self) -> Result<Self, ColumnError>
pub fn in1d(&self, other: &Self) -> Result<Self, ColumnError>
Test whether each element is contained in other.
Matches np.in1d(). Returns Bool column.
Sourcepub fn value_counts(&self) -> Result<(Self, Self), ColumnError>
pub fn value_counts(&self) -> Result<(Self, Self), ColumnError>
Count occurrences of each distinct value.
Matches pd.Series.value_counts() default behavior at the
columnar level: missing values are dropped, counts are sorted
descending, and first-seen order breaks ties.
Sourcepub fn value_counts_with_options(
&self,
normalize: bool,
sort: bool,
ascending: bool,
dropna: bool,
) -> Result<(Self, Self), ColumnError>
pub fn value_counts_with_options( &self, normalize: bool, sort: bool, ascending: bool, dropna: bool, ) -> Result<(Self, Self), ColumnError>
Count occurrences of each distinct value with pandas-style options.
Returns a pair of columns (values, counts). The values
column preserves the source dtype; the counts column is Int64
unless normalize=true, in which case it is Float64.