Skip to main content

Column

Struct Column 

Source
pub struct Column { /* private fields */ }

Implementations§

Source§

impl Column

Source

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.

Source

pub fn from_values(values: Vec<Scalar>) -> Result<Self, ColumnError>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

pub fn zeros(n: usize, dtype: DType) -> Result<Self, ColumnError>

Create a column filled with zeros.

Matches np.zeros().

Source

pub fn ones(n: usize, dtype: DType) -> Result<Self, ColumnError>

Create a column filled with ones.

Matches np.ones().

Source

pub fn full(n: usize, fill_value: Scalar) -> Result<Self, ColumnError>

Create a column filled with a given value.

Matches np.full().

Source

pub fn zeros_like(&self) -> Result<Self, ColumnError>

Create a zeros column with same shape and dtype as self.

Source

pub fn ones_like(&self) -> Result<Self, ColumnError>

Create a ones column with same shape and dtype as self.

Source

pub fn full_like(&self, fill_value: Scalar) -> Result<Self, ColumnError>

Create a column filled with fill_value with same shape as self.

Source

pub fn empty_like(&self) -> Result<Self, ColumnError>

Create an empty column with same dtype as self.

Source

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().

Source

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().

Source

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().

Source

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).

Source

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.

Source

pub fn hamming(m: usize) -> Result<Self, ColumnError>

Generate a Hamming window.

Matches np.hamming(M). Returns a Hamming window of length M.

Source

pub fn blackman(m: usize) -> Result<Self, ColumnError>

Generate a Blackman window.

Matches np.blackman(M). Returns a Blackman window of length M.

Source

pub fn bartlett(m: usize) -> Result<Self, ColumnError>

Generate a Bartlett (triangular) window.

Matches np.bartlett(M). Returns a triangular window of length M.

Source

pub fn dtype(&self) -> DType

Source

pub fn has_nulls(&self) -> bool

Returns true if this column contains any null/missing values.

Source

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.

Source

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.

Source

pub fn len(&self) -> usize

Source

pub fn size(&self) -> usize

Number of elements, matching pd.Series.size.

Source

pub fn shape(&self) -> (usize,)

One-dimensional shape, matching pd.Series.shape.

Source

pub fn ndim(&self) -> usize

Number of array dimensions, matching pd.Series.ndim.

Source

pub fn is_empty(&self) -> bool

Source

pub fn empty(&self) -> bool

Alias for is_empty, matching pd.Series.empty.

Source

pub fn copy(&self) -> Self

Return a deep copy of this column.

Matches pd.Series.copy(deep=True) at the column storage layer.

Source

pub fn view(&self) -> Self

Return an immutable view-shaped clone of this column.

Matches pd.Series.view() at the column storage layer.

Source

pub fn transpose(&self) -> Self

One-dimensional transpose is identity.

Matches pd.Series.transpose() at the column storage layer.

Source

pub fn t(&self) -> Self

Lowercase alias for transpose.

Source

pub fn T(&self) -> Self

Uppercase pandas spelling for transpose.

Source

pub fn values(&self) -> &[Scalar]

Source

pub fn value(&self, idx: usize) -> Option<&Scalar>

Source

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.

Source

pub fn validity(&self) -> &ValidityMask

Source

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.

Source

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.

Source

pub fn to_list(&self) -> Vec<Scalar>

Alias for to_vec, matching pd.Series.to_list().

Source

pub fn tolist(&self) -> Vec<Scalar>

Alias for to_list, matching pd.Series.tolist().

Source

pub fn to_numpy(&self) -> Vec<Scalar>

Owned scalar materialization, matching pd.Series.to_numpy().

Source

pub fn ravel(&self) -> Vec<Scalar>

Flatten values to a one-dimensional vector, matching pd.Series.ravel().

Source

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.

Source

pub fn asarray(&self) -> Self

Convert to array, matching np.asarray().

For Column this returns a clone since we’re already array-like.

Source

pub fn array(&self) -> Vec<Scalar>

Owned scalar materialization, matching pd.Series.array.

Source

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.

Source

pub fn hasnans(&self) -> bool

Whether any value is missing, matching pd.Series.hasnans.

Source

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.

Source

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.

Source

pub fn last(&self) -> Option<&Scalar>

Last value in the column, or None when empty.

Source

pub fn count_matching<F>(&self, predicate: F) -> usize
where F: FnMut(&Scalar) -> bool,

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).

Source

pub fn zip_with<F>(&self, other: &Self, func: F) -> Result<Self, ColumnError>
where F: FnMut(&Scalar, &Scalar) -> Scalar,

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.

Source

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.

Source

pub fn apply_bool<F>(&self, predicate: F) -> Result<Self, ColumnError>
where F: FnMut(&Scalar) -> bool,

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.

Source

pub fn reindex_by_positions( &self, positions: &[Option<usize>], ) -> Result<Self, ColumnError>

Source

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.

Source

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.

Source

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.

Source

pub fn binary_numeric( &self, right: &Self, op: ArithmeticOp, ) -> Result<Self, ColumnError>

Source

pub fn add(&self, right: &Self) -> Result<Self, ColumnError>

Element-wise addition, matching pd.Series.add().

Source

pub fn radd(&self, left: &Self) -> Result<Self, ColumnError>

Reverse element-wise addition, matching pd.Series.radd().

Source

pub fn sub(&self, right: &Self) -> Result<Self, ColumnError>

Element-wise subtraction, matching pd.Series.sub().

Source

pub fn rsub(&self, left: &Self) -> Result<Self, ColumnError>

Reverse element-wise subtraction, matching pd.Series.rsub().

Source

pub fn subtract(&self, right: &Self) -> Result<Self, ColumnError>

Alias for sub, matching pd.Series.subtract().

Source

pub fn mul(&self, right: &Self) -> Result<Self, ColumnError>

Element-wise multiplication, matching pd.Series.mul().

Source

pub fn rmul(&self, left: &Self) -> Result<Self, ColumnError>

Reverse element-wise multiplication, matching pd.Series.rmul().

Source

pub fn multiply(&self, right: &Self) -> Result<Self, ColumnError>

Alias for mul, matching pd.Series.multiply().

Source

pub fn div(&self, right: &Self) -> Result<Self, ColumnError>

Element-wise true division, matching pd.Series.div().

Source

pub fn rdiv(&self, left: &Self) -> Result<Self, ColumnError>

Reverse element-wise true division, matching pd.Series.rdiv().

Source

pub fn divide(&self, right: &Self) -> Result<Self, ColumnError>

Alias for div, matching pd.Series.divide().

Source

pub fn truediv(&self, right: &Self) -> Result<Self, ColumnError>

Alias for div, matching pd.Series.truediv().

Source

pub fn rtruediv(&self, left: &Self) -> Result<Self, ColumnError>

Alias for rdiv, matching pd.Series.rtruediv().

Source

pub fn floordiv(&self, right: &Self) -> Result<Self, ColumnError>

Element-wise floor division, matching pd.Series.floordiv().

Source

pub fn rfloordiv(&self, left: &Self) -> Result<Self, ColumnError>

Reverse element-wise floor division, matching pd.Series.rfloordiv().

Source

pub fn mod(&self, right: &Self) -> Result<Self, ColumnError>

Element-wise modulo, matching pd.Series.mod().

Source

pub fn rmod(&self, left: &Self) -> Result<Self, ColumnError>

Reverse element-wise modulo, matching pd.Series.rmod().

Source

pub fn pow(&self, right: &Self) -> Result<Self, ColumnError>

Element-wise exponentiation, matching pd.Series.pow().

Source

pub fn rpow(&self, left: &Self) -> Result<Self, ColumnError>

Reverse element-wise exponentiation, matching pd.Series.rpow().

Source

pub fn power(&self, right: &Self) -> Result<Self, ColumnError>

Alias for pow, matching NumPy naming.

Source

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).

Source

pub fn remainder(&self, right: &Self) -> Result<Self, ColumnError>

Alias for mod, matching NumPy naming.

Source

pub fn floor_divide(&self, right: &Self) -> Result<Self, ColumnError>

Alias for floordiv, matching NumPy naming.

Source

pub fn true_divide(&self, right: &Self) -> Result<Self, ColumnError>

Alias for div, matching NumPy naming.

Source

pub fn atan2(&self, other: &Self) -> Result<Self, ColumnError>

Element-wise arctangent of y/x.

Source

pub fn hypot(&self, other: &Self) -> Result<Self, ColumnError>

Element-wise Euclidean distance sqrt(x^2 + y^2).

Source

pub fn fmod(&self, other: &Self) -> Result<Self, ColumnError>

Element-wise floating-point remainder (fmod).

Source

pub fn copysign(&self, other: &Self) -> Result<Self, ColumnError>

Element-wise copysign: magnitude of self with sign of other.

Source

pub fn sign(&self) -> Result<Self, ColumnError>

Element-wise sign: -1, 0, or 1.

Source

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.

Source

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
Source

pub fn gcd(&self, other: &Self) -> Result<Self, ColumnError>

Element-wise greatest common divisor.

Matches np.gcd(x, y). Works on integer values.

Source

pub fn lcm(&self, other: &Self) -> Result<Self, ColumnError>

Element-wise least common multiple.

Matches np.lcm(x, y). Works on integer values.

Source

pub fn bitwise_and(&self, other: &Self) -> Result<Self, ColumnError>

Element-wise bitwise AND.

Source

pub fn bitwise_or(&self, other: &Self) -> Result<Self, ColumnError>

Element-wise bitwise OR.

Source

pub fn bitwise_xor(&self, other: &Self) -> Result<Self, ColumnError>

Element-wise bitwise XOR.

Source

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.

Source

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.

Source

pub fn bitwise_not(&self) -> Result<Self, ColumnError>

Element-wise bitwise NOT (invert).

Source

pub fn invert(&self) -> Result<Self, ColumnError>

Alias for bitwise_not.

Source

pub fn maximum(&self, other: &Self) -> Result<Self, ColumnError>

Element-wise maximum, NaN propagates.

Source

pub fn minimum(&self, other: &Self) -> Result<Self, ColumnError>

Element-wise minimum, NaN propagates.

Source

pub fn fmax(&self, other: &Self) -> Result<Self, ColumnError>

Element-wise maximum, ignoring NaN.

Source

pub fn fmin(&self, other: &Self) -> Result<Self, ColumnError>

Element-wise minimum, ignoring NaN.

Source

pub fn logical_and(&self, other: &Self) -> Result<Self, ColumnError>

Logical AND between two boolean columns.

Source

pub fn logical_or(&self, other: &Self) -> Result<Self, ColumnError>

Logical OR between two boolean columns.

Source

pub fn logical_xor(&self, other: &Self) -> Result<Self, ColumnError>

Logical XOR between two boolean columns.

Source

pub fn logical_not(&self) -> Result<Self, ColumnError>

Logical NOT (element-wise negation to boolean).

Source

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.

Source

pub fn eq(&self, right: &Self) -> Result<Self, ColumnError>

Element-wise equality, matching pd.Series.eq().

Source

pub fn ne(&self, right: &Self) -> Result<Self, ColumnError>

Element-wise inequality, matching pd.Series.ne().

Source

pub fn lt(&self, right: &Self) -> Result<Self, ColumnError>

Element-wise less-than comparison, matching pd.Series.lt().

Source

pub fn le(&self, right: &Self) -> Result<Self, ColumnError>

Element-wise less-than-or-equal comparison, matching pd.Series.le().

Source

pub fn gt(&self, right: &Self) -> Result<Self, ColumnError>

Element-wise greater-than comparison, matching pd.Series.gt().

Source

pub fn ge(&self, right: &Self) -> Result<Self, ColumnError>

Element-wise greater-than-or-equal comparison, matching pd.Series.ge().

Source

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.

Source

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).

Source

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.

Source

pub fn dropna(&self) -> Result<Self, ColumnError>

Remove missing values, returning a shorter column.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn split(&self, n: usize) -> Result<Vec<Self>, ColumnError>

Alias for array_split.

Source

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().

Source

pub fn append(&self, other: &Self) -> Result<Self, ColumnError>

Alias for concat, matching np.append.

Source

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.

Source

pub fn delete(&self, indices: &[usize]) -> Result<Self, ColumnError>

Delete values at given indices.

Matches np.delete(). Returns new column with values removed.

Source

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.

Source

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.

Source

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.

Source

pub fn reverse(&self) -> Result<Self, ColumnError>

Reverse the row order of the column.

Matches pd.Series[::-1] / iloc[::-1]. Dtype is preserved.

Source

pub fn flip(&self) -> Result<Self, ColumnError>

Alias for reverse, matching np.flip.

Source

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).

Source

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.

Source

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).

Source

pub fn cumprod(&self) -> Result<Self, ColumnError>

Cumulative product, null-propagating per fp-types::nancumprod.

Source

pub fn cummax(&self) -> Result<Self, ColumnError>

Cumulative maximum, null-propagating per fp-types::nancummax.

Source

pub fn cummin(&self) -> Result<Self, ColumnError>

Cumulative minimum, null-propagating per fp-types::nancummin.

Source

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).

Source

pub fn mean(&self) -> Scalar

Arithmetic mean of non-missing values.

Matches pd.Series.mean() via fp-types::nanmean. Empty column returns Null(NaN).

Source

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.

Source

pub fn average(&self, weights: &Self) -> Scalar

Alias for weighted_mean, matching np.average naming.

Source

pub fn min(&self) -> Scalar

Minimum non-missing value.

Matches pd.Series.min() via fp-types::nanmin. Preserves dtype for homogeneous inputs.

Source

pub fn max(&self) -> Scalar

Maximum non-missing value.

Matches pd.Series.max() via fp-types::nanmax.

Source

pub fn median(&self) -> Scalar

Median of non-missing values.

Matches pd.Series.median() via fp-types::nanmedian.

Source

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).

Source

pub fn product(&self) -> Scalar

Alias for prod, matching pd.Series.product().

Source

pub fn nansum(&self) -> Scalar

Alias for sum, matching np.nansum.

Source

pub fn nanmean(&self) -> Scalar

Alias for mean, matching np.nanmean.

Source

pub fn nanmin(&self) -> Scalar

Alias for min, matching np.nanmin.

Source

pub fn nanmax(&self) -> Scalar

Alias for max, matching np.nanmax.

Source

pub fn nanprod(&self) -> Scalar

Alias for prod, matching np.nanprod.

Source

pub fn nanstd(&self, ddof: usize) -> Scalar

Alias for std, matching np.nanstd.

Source

pub fn nanvar(&self, ddof: usize) -> Scalar

Alias for var, matching np.nanvar.

Source

pub fn nanmedian(&self) -> Scalar

Alias for median, matching np.nanmedian.

Source

pub fn sum_skipna(&self, skipna: bool) -> Scalar

Sum with explicit pandas skipna= control.

Matches pd.Series.sum(skipna=...).

Source

pub fn mean_skipna(&self, skipna: bool) -> Scalar

Mean with explicit pandas skipna= control.

Source

pub fn min_skipna(&self, skipna: bool) -> Scalar

Minimum with explicit pandas skipna= control.

Source

pub fn max_skipna(&self, skipna: bool) -> Scalar

Maximum with explicit pandas skipna= control.

Source

pub fn median_skipna(&self, skipna: bool) -> Scalar

Median with explicit pandas skipna= control.

Source

pub fn prod_skipna(&self, skipna: bool) -> Scalar

Product with explicit pandas skipna= control.

Source

pub fn var_skipna(&self, ddof: usize, skipna: bool) -> Scalar

Variance with explicit pandas skipna= control.

Source

pub fn std_skipna(&self, ddof: usize, skipna: bool) -> Scalar

Standard deviation with explicit pandas skipna= control.

Source

pub fn sem_skipna(&self, ddof: usize, skipna: bool) -> Scalar

Standard error of the mean with explicit pandas skipna= control.

Source

pub fn count(&self) -> usize

Count of non-missing values.

Matches pd.Series.count().

Source

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.

Source

pub fn pad(&self, limit: Option<usize>) -> Result<Self, ColumnError>

Alias for ffill, matching deprecated pd.Series.pad().

Source

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.

Source

pub fn backfill(&self, limit: Option<usize>) -> Result<Self, ColumnError>

Alias for bfill, matching deprecated pd.Series.backfill().

Source

pub fn nunique(&self) -> Scalar

Count of distinct non-missing values.

Matches pd.Series.nunique(dropna=True).

Source

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.

Source

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).

Source

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.

Source

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).

Source

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.

Source

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.

Source

pub fn first_valid_index(&self) -> Option<usize>

Alias for first_valid, matching pd.Series.first_valid_index() for positional indices.

Source

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.

Source

pub fn last_valid_index(&self) -> Option<usize>

Alias for last_valid, matching pd.Series.last_valid_index() for positional indices.

Source

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.

Source

pub fn isnull(&self) -> Result<Self, ColumnError>

Per-row missing-value flag (Bool column).

Matches pd.Series.isna() / isnull().

Source

pub fn isna(&self) -> Result<Self, ColumnError>

Alias for isnull, matching pd.Series.isna().

Source

pub fn notnull(&self) -> Result<Self, ColumnError>

Per-row non-missing flag (Bool column).

Matches pd.Series.notna() / notnull().

Source

pub fn notna(&self) -> Result<Self, ColumnError>

Alias for notnull, matching pd.Series.notna().

Source

pub fn isfinite(&self) -> Result<Self, ColumnError>

Per-row check for finite values (not NaN or infinity).

Source

pub fn isinf(&self) -> Result<Self, ColumnError>

Per-row check for infinite values.

Source

pub fn isnan(&self) -> Result<Self, ColumnError>

Per-row check for NaN values.

Source

pub fn var(&self, ddof: usize) -> Scalar

Sample variance (ddof-parameterized).

Matches pd.Series.var(ddof=1).

Source

pub fn std(&self, ddof: usize) -> Scalar

Sample standard deviation (ddof-parameterized).

Matches pd.Series.std(ddof=1).

Source

pub fn sem(&self, ddof: usize) -> Scalar

Standard error of the mean (ddof-parameterized).

Matches pd.Series.sem(ddof=1).

Source

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.

Source

pub fn cov_ddof(&self, other: &Self, ddof: usize) -> Scalar

Sample covariance with custom ddof.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn kurtosis(&self) -> Scalar

Alias for kurt, matching pd.Series.kurtosis().

Source

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.

Source

pub fn is_unique(&self) -> bool

Whether every non-missing value is distinct.

Matches pd.Series.is_unique.

Source

pub fn has_duplicates(&self) -> bool

Whether any non-missing value repeats.

Matches pd.Series.has_duplicates.

Source

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).

Source

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.

Source

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.

Source

pub fn combine<F>( &self, other: &Self, func: F, fill: Option<Scalar>, ) -> Result<Self, ColumnError>
where F: FnMut(&Scalar, &Scalar) -> Scalar,

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.

Source

pub fn apply_float<F>(&self, func: F) -> Result<Self, ColumnError>
where F: FnMut(f64) -> f64,

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.

Source

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.

Source

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.

Source

pub fn idxmin(&self) -> Option<usize>

Alias for argmin, matching pd.Series.idxmin() for positional indices.

Source

pub fn argmax(&self) -> Option<usize>

Position of the largest non-missing value, or None when every value is missing.

Matches pd.Series.argmax().

Source

pub fn idxmax(&self) -> Option<usize>

Alias for argmax, matching pd.Series.idxmax() for positional indices.

Source

pub fn nanargmin(&self) -> Option<usize>

Alias for argmin, matching np.nanargmin.

Source

pub fn nanargmax(&self) -> Option<usize>

Alias for argmax, matching np.nanargmax.

Source

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.

Source

pub fn is_monotonic_decreasing(&self) -> bool

Whether non-missing values are non-increasing.

Matches pd.Series.is_monotonic_decreasing.

Source

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.

Source

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.

Source

pub fn clip_upper(&self, upper: f64) -> Result<Self, ColumnError>

Clip values above upper, leaving the lower bound free.

Matches pd.Series.clip(upper=...).

Source

pub fn drop_duplicates(&self) -> Result<Self, ColumnError>

Remove duplicated values, keeping the first occurrence.

Matches pd.Series.drop_duplicates(keep='first').

Source

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.

Source

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.

Source

pub fn map<F>(&self, func: F) -> Result<Self, ColumnError>
where F: FnMut(&Scalar) -> Scalar,

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).

Source

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.

Source

pub fn interpolate(&self) -> Result<Self, ColumnError>

Alias for interpolate_linear, matching the default pd.Series.interpolate() behavior.

Source

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].

Source

pub fn percentile(&self, p: f64) -> Scalar

Percentile of non-missing values.

Matches np.percentile(). Takes percentile p in [0, 100].

Source

pub fn nanquantile(&self, q: f64) -> Scalar

Alias for quantile, matching np.nanquantile.

Source

pub fn nanpercentile(&self, p: f64) -> Scalar

Alias for percentile, matching np.nanpercentile.

Source

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.

Source

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.

Source

pub fn nbytes(&self) -> usize

Approximate value-buffer footprint, matching pd.Series.nbytes.

Source

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.

Source

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).

Source

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.

Source

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
Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn count_nonzero(&self) -> usize

Count number of non-zero elements.

Matches np.count_nonzero().

Source

pub fn flatnonzero(&self) -> Result<Self, ColumnError>

Indices of non-zero elements as a column.

Matches np.flatnonzero(). Returns Int64 column of indices.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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].

Source

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.

Source

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]].

Source

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.

Source

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.

Source

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 first n rows in ascending order, break ties by original position (stable).
  • "last": on ties, prefer later-appearing rows.
  • "all": include every row tied with the n-th smallest, so the returned column can exceed n.
Source

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.

Source

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.

Source

pub fn nsmallest(&self, n: usize) -> Result<Self, ColumnError>

Return the n smallest values.

Matches pd.Series.nsmallest(n) with keep='first'.

Source

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.

Source

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).

Source

pub fn sort_values(&self, ascending: bool) -> Result<Self, ColumnError>

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn gradient(&self) -> Result<Self, ColumnError>

Numerical gradient using central differences.

Matches np.gradient() with uniform spacing.

Source

pub fn trapz(&self, dx: f64) -> Result<Scalar, ColumnError>

Trapezoidal numerical integration.

Matches np.trapz(). Returns scalar result of integral.

Source

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).

Source

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.

Source

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.

Source

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".

Source

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.

Source

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.

Source

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().

Source

pub fn fabs(&self) -> Result<Self, ColumnError>

Alias for abs, matching np.fabs.

Source

pub fn absolute(&self) -> Result<Self, ColumnError>

Alias for abs, matching np.absolute.

Source

pub fn neg(&self) -> Result<Self, ColumnError>

Negate numeric values. Matches numpy’s negative ufunc.

Source

pub fn positive(&self) -> Result<Self, ColumnError>

Unary positive (identity for numeric, error for non-numeric).

Source

pub fn negative(&self) -> Result<Self, ColumnError>

Alias for positive.

Source

pub fn sqrt(&self) -> Result<Self, ColumnError>

Square root of numeric values. Matches numpy’s sqrt ufunc.

Source

pub fn exp(&self) -> Result<Self, ColumnError>

Exponential (e^x) of numeric values. Matches numpy’s exp ufunc.

Source

pub fn log(&self) -> Result<Self, ColumnError>

Natural logarithm of numeric values. Matches numpy’s log ufunc.

Source

pub fn log10(&self) -> Result<Self, ColumnError>

Base-10 logarithm of numeric values. Matches numpy’s log10 ufunc.

Source

pub fn log2(&self) -> Result<Self, ColumnError>

Base-2 logarithm of numeric values. Matches numpy’s log2 ufunc.

Source

pub fn sin(&self) -> Result<Self, ColumnError>

Compute element-wise sine.

Source

pub fn cos(&self) -> Result<Self, ColumnError>

Compute element-wise cosine.

Source

pub fn tan(&self) -> Result<Self, ColumnError>

Compute element-wise tangent.

Source

pub fn asin(&self) -> Result<Self, ColumnError>

Compute element-wise arcsine.

Source

pub fn acos(&self) -> Result<Self, ColumnError>

Compute element-wise arccosine.

Source

pub fn atan(&self) -> Result<Self, ColumnError>

Compute element-wise arctangent.

Source

pub fn sinh(&self) -> Result<Self, ColumnError>

Compute element-wise hyperbolic sine.

Source

pub fn cosh(&self) -> Result<Self, ColumnError>

Compute element-wise hyperbolic cosine.

Source

pub fn tanh(&self) -> Result<Self, ColumnError>

Compute element-wise hyperbolic tangent.

Source

pub fn asinh(&self) -> Result<Self, ColumnError>

Compute element-wise inverse hyperbolic sine.

Source

pub fn acosh(&self) -> Result<Self, ColumnError>

Compute element-wise inverse hyperbolic cosine.

Source

pub fn atanh(&self) -> Result<Self, ColumnError>

Compute element-wise inverse hyperbolic tangent.

Source

pub fn arcsin(&self) -> Result<Self, ColumnError>

Numpy-style alias for asin.

Matches np.arcsin(x).

Source

pub fn arccos(&self) -> Result<Self, ColumnError>

Numpy-style alias for acos.

Matches np.arccos(x).

Source

pub fn arctan(&self) -> Result<Self, ColumnError>

Numpy-style alias for atan.

Matches np.arctan(x).

Source

pub fn arctan2(&self, other: &Self) -> Result<Self, ColumnError>

Numpy-style alias for atan2.

Matches np.arctan2(y, x).

Source

pub fn arcsinh(&self) -> Result<Self, ColumnError>

Numpy-style alias for asinh.

Matches np.arcsinh(x).

Source

pub fn arccosh(&self) -> Result<Self, ColumnError>

Numpy-style alias for acosh.

Matches np.arccosh(x).

Source

pub fn arctanh(&self) -> Result<Self, ColumnError>

Numpy-style alias for atanh.

Matches np.arctanh(x).

Source

pub fn floor(&self) -> Result<Self, ColumnError>

Source

pub fn ceil(&self) -> Result<Self, ColumnError>

Compute element-wise ceiling.

Source

pub fn trunc(&self) -> Result<Self, ColumnError>

Compute element-wise truncation toward zero.

Source

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.

Source

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).

Source

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.

Source

pub fn fix(&self) -> Result<Self, ColumnError>

Round toward zero (same as trunc).

Matches np.fix(x). Alias for trunc().

Source

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
Source

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).

Source

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).

Source

pub fn expm1(&self) -> Result<Self, ColumnError>

Compute exp(x) - 1 with improved precision for small x.

Source

pub fn log1p(&self) -> Result<Self, ColumnError>

Compute ln(1 + x) with improved precision for small x.

Source

pub fn cbrt(&self) -> Result<Self, ColumnError>

Compute element-wise cube root.

Source

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.

Source

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.

Source

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
Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn sinc(&self) -> Result<Self, ColumnError>

Compute the sinc function.

Matches np.sinc(x). Returns sin(pix) / (pix), with sinc(0) = 1.

Source

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.

Source

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.

Source

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.

Source

pub fn radians(&self) -> Result<Self, ColumnError>

Convert angles from degrees to radians.

Source

pub fn deg2rad(&self) -> Result<Self, ColumnError>

Alias for radians.

Source

pub fn degrees(&self) -> Result<Self, ColumnError>

Convert angles from radians to degrees.

Source

pub fn rad2deg(&self) -> Result<Self, ColumnError>

Alias for degrees.

Source

pub fn reciprocal(&self) -> Result<Self, ColumnError>

Compute element-wise reciprocal (1/x).

Source

pub fn square(&self) -> Result<Self, ColumnError>

Compute element-wise square (x^2).

Source

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).

Source

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.

Source

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.

Source

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).

Source

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.

Source

pub fn setdiff1d(&self, other: &Self) -> Result<Self, ColumnError>

Set difference: values in self that are not in other.

Matches np.setdiff1d().

Source

pub fn intersect1d(&self, other: &Self) -> Result<Self, ColumnError>

Set intersection: values common to both columns.

Matches np.intersect1d().

Source

pub fn union1d(&self, other: &Self) -> Result<Self, ColumnError>

Set union: unique values from both columns.

Matches np.union1d().

Source

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.

Source

pub fn in1d(&self, other: &Self) -> Result<Self, ColumnError>

Test whether each element is contained in other.

Matches np.in1d(). Returns Bool column.

Source

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.

Source

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.

Source

pub fn semantic_eq(&self, other: &Self) -> bool

Source

pub fn isclose( &self, other: &Self, rtol: f64, atol: f64, ) -> Result<Self, ColumnError>

Element-wise comparison for approximate equality.

Matches np.isclose(). Returns True where |a - b| <= atol + rtol * |b|.

Source

pub fn allclose( &self, other: &Self, rtol: f64, atol: f64, ) -> Result<bool, ColumnError>

Check if all elements are approximately equal.

Matches np.allclose(). Returns True if all pairs satisfy isclose.

Trait Implementations§

Source§

impl Clone for Column

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Column

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Column

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Column

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Column

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.