pub struct Column { /* private fields */ }Implementations§
Source§impl Column
impl Column
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_f64_values(data: Vec<f64>) -> Self
pub fn from_f64_values(data: Vec<f64>) -> Self
Build an all-valid Float64 column from already-typed contiguous values.
This is the typed ingestion counterpart to Column::new(DType::Float64, Vec<Scalar>) for sources that have already proven every value is a
valid f64.
Sourcepub fn as_f64_slice(&self) -> Option<&[f64]>
pub fn as_f64_slice(&self) -> Option<&[f64]>
Borrow the column’s contiguous f64 buffer when this is an all-valid
Float64 column, enabling typed/SIMD reductions without the per-element
Scalar match. Returns None for any other dtype or when the column
has missing values — callers fall back to the Scalar path, which is
the only path that must reason about missingness. Per
br-frankenpandas-lei31.
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 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_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 fold the
missing-normalization and validity rebuild into a single pass.
The output is bit-for-bit identical to
Column::new(self.dtype(), positions.iter().map(|&p| self.values[p].clone()).collect())
(the no-coercion branch Column::new takes for same-dtype input): each
gathered value is missing-normalized via normalize_missing_for_dtype
(generic Null → dtype-specific missing, e.g. NaT for datetime), and
the validity mask is recomputed from the normalized values’
is_missing() exactly as ValidityMask::from_values would.
§Panics
Panics if any position is out of bounds (callers materialize from
validated index positions; this mirrors the prior values()[pos] index).
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
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 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_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 a Bool-typed column.
Both columns must have the same length. Missing values (Null or NaN) propagate: if either operand is missing, the result is missing.
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 a Bool-typed column.
Missing values in the column propagate as missing in the result.
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().
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 sum(&self) -> Scalar
pub fn sum(&self) -> Scalar
Sum of non-missing values.
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.
Sourcepub fn median(&self) -> Scalar
pub fn median(&self) -> Scalar
Median of non-missing values.
Matches pd.Series.median() via fp-types::nanmedian.
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 var(&self, ddof: usize) -> Scalar
pub fn var(&self, ddof: usize) -> Scalar
Sample variance (ddof-parameterized).
Matches pd.Series.var(ddof=1).
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.
Sourcepub fn skew(&self) -> Scalar
pub fn skew(&self) -> Scalar
Sample skewness (bias-corrected, Fisher-Pearson).
Matches pd.Series.skew(). Requires at least 3 non-missing
values; returns Null(NaN) otherwise.
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.
Matches pd.Series.has_duplicates.
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.
Sourcepub fn quantile(&self, q: f64) -> Scalar
pub fn quantile(&self, q: f64) -> Scalar
Linear-interpolation quantile at q ∈ [0.0, 1.0].
Matches pd.Series.quantile(q, interpolation='linear').
Missing values are skipped (skipna=True). Returns
Null(NaN) for empty columns or q outside [0.0, 1.0].
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 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
Sourcepub fn nextafter(&self, other: &Self) -> Result<Self, ColumnError>
pub fn nextafter(&self, other: &Self) -> Result<Self, ColumnError>
Return the next representable floating-point value after x toward y.
Matches np.nextafter(x, y). For each pair of elements, returns the next representable float after x in the direction of y.
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.