Skip to main content

Column

Struct Column 

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

Implementations§

Source§

impl Column

Source

pub fn from_object_values(values: Vec<Scalar>) -> Self

A pandas object column holding values exactly as given: no coercion, so ints stay ints and a missing value stays missing. astype(object) / dtype=object need this; Self::new with DType::Utf8 stringifies a homogeneous column (None became the string ‘None’; br-frankenpandas-rc0923-epic-python-honest-dropin-fvsao.22).

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_i64_constant(value: i64, len: usize) -> Self

len copies of value, a broadcast number (df['z'] = 7): the column from_i64_values makes of vec![value; len], the copies written straight into its Arc<[i64]> - that path filled a Vec and copied it into the Arc (br-frankenpandas-1s45z).

Source

pub fn from_bool_constant(value: bool, len: usize) -> Self

len copies of value, a broadcast bool (df['z'] = True): the column from_bool_values makes of vec![value; len], the copies written straight into its Arc<[bool]> - that path filled a Vec and copied it into the Arc (br-frankenpandas-1s45z).

Source

pub fn from_f64_constant(value: f64, len: usize) -> Self

len copies of value, a broadcast number (df['z'] = 1.5): the column from_f64_values makes of vec![value; len] - all-valid, NaN-exact, its finite witness the number’s - without that path’s NaN / finite scan and Vec-to-Arc copy (0.50 ms a million rows, pandas 0.13; br-frankenpandas-1s45z). A NaN (or no rows) takes that path.

Source

pub fn from_i64_values_owned(data: Vec<i64>) -> Self

Like from_i64_values but MOVES the Vec<i64> into the backing (one Arc::new) instead of Arc::from(Vec)’s alloc+memcpy (~28ms/5M). The i64 sibling of from_f64_values_owned; all-valid (i64 has no NaN sentinel).

Source

pub fn timezone(&self) -> Option<&str>

Return this column’s uniform datetime timezone, if it has one.

Source

pub fn from_f64_values(data: Vec<f64>) -> Self

Source

pub fn from_f64_arc(data: Arc<[f64]>) -> Self

Self::from_f64_values of a buffer already in the Arc<[f64]> that column keeps: the same NaN-exact column without its Arc::from(Vec) copy - for a reader that can fill the Arc directly (a numpy array’s contiguous buffer; br-frankenpandas-br362).

Source

pub fn from_f64_values_owned(data: Vec<f64>) -> Self

Like from_f64_values but, for the all-valid (no-NaN) case, MOVES the owned Vec<f64> into the backing (Arc::new, one tiny box) instead of Arc::from(Vec)’s cold-buffer realloc-copy (~5.7ms/1M, page-fault-bound). For op OUTPUTS that just wrote a hot Vec (cumsum/cummax/cummin/cumprod) this is a 6-8x op-side win. Bit-identical: the single NaN scan is the same one from_f64_values runs, and a NaN-bearing output routes to the identical from_f64_values (NaN-as-missing) path. The resulting LazyAllValidFloat64Vec backing is semantically identical to LazyAllValidFloat64 (it just isn’t keyed by the Arc<f64>-specific take_positions/binary zero-copy fast paths — fine for terminal outputs).

Source

pub fn from_f64_values_nullable(data: Vec<f64>, validity: ValidityMask) -> Self

Build a nullable Float64 column from a raw data buffer plus an EXPLICIT validity mask, WITHOUT re-deriving validity from NaN. The LazyNullableFloat64 backing renders each slot as: validity-set ⇒ present Float64(data); cleared-bit-with-NaN-datum ⇒ present Float64(NaN); cleared-bit-with- non-NaN-datum ⇒ Null(NullKind::NaN). This is the only constructor that reproduces the per-element Scalar path’s three-way representation for typed nullable arithmetic outputs (a GENERATED NaN must stay a present Float64(NaN), an absent operand must be Null). Callers set the validity bit iff the slot is present AND its datum is non-NaN.

Source

pub fn from_f64_shared_window( data: Arc<[f64]>, start: usize, len: usize, ) -> Self

Build an all-valid Float64 column as a ZERO-COPY WINDOW into a shared buffer: data[start .. start + len].

Added for the transposed-frame plan, whose output has one column per SOURCE ROW — 100_000 of them at the 100k fixture. Building each as its own heap Column costs one allocation, one OnceLock init and one drop per output column; profiled on df_transpose_full_materialize_positional those three lines were ~43% of the whole lane (drop_glue 14.49%, OnceLock machinery ~14.8%, mimalloc ~14%). A page of output columns can instead share ONE gathered buffer, with each column a window into it.

The caller guarantees the window is all-valid and NaN-free, exactly as Self::from_f64_all_valid_with_finite_opt requires; the window bounds are debug-asserted by the underlying ScalarValues constructor.

Source

pub fn from_f64_all_valid_dot_product_shared( a_panel: &Float64DotAPanel, b_col: Arc<[f64]>, len: usize, ) -> Self

Source

pub fn from_bool_values_with_validity( data: Vec<bool>, validity: ValidityMask, ) -> Self

Build a Bool column from already-typed contiguous values plus a validity mask (br-frankenpandas-rcvpj). The nullable counterpart of Column::from_bool_values: an all-valid mask folds to the contiguous all-valid backing, otherwise invalid slots materialize Scalar::Null(NullKind::Null) (= missing_for_dtype(Bool)), exactly what Column::from_values over the equivalent [Bool/Null] scalars produces — but defers the per-row Scalar boxing + dtype inference. Used by null-bearing comparison / where / mask / isin outputs.

Source

pub fn as_f64_slice_with_validity(&self) -> Option<(&[f64], &ValidityMask)>

Source

pub fn as_i64_slice_with_validity(&self) -> Option<(&[i64], &ValidityMask)>

Int64 analogue of Self::as_f64_slice_with_validity: the contiguous i64 buffer plus its validity (works for an all-valid OR a LazyNullableInt64 backing). Missingness is the validity bit alone (no NaN sentinel).

Source

pub fn materialize_dot_columns_parallel(columns: &[&Self])

Force every pending df.dot output column in columns in ONE scope, parallel across columns.

br-frankenpandas-1hjgz. See ScalarValues::materialize_dot_columns_parallel for why the parallelism is across columns rather than inside one, and why this is bit-identical rather than a new kernel. Columns that are not dot results, or whose result is already computed, are skipped — so calling this on an arbitrary frame costs one pass over the column list and nothing else.

Source

pub fn materialize_dot_columns_with_mode(columns: &[&Self], serial: bool)

As Self::materialize_dot_columns_parallel, but with the serial/parallel choice passed IN. See ScalarValues::materialize_dot_columns_with_mode for why the environment toggle cannot serve a test.

Source

pub fn materialize_dot_columns_with_workers( columns: &[&Self], serial: bool, max_workers: usize, )

As Self::materialize_dot_columns_with_mode, but with the worker cap passed IN. See ScalarValues::materialize_dot_columns_with_workers.

Source

pub fn materialize_dot_columns_with_policy( columns: &[&Self], serial: bool, max_workers: usize, work_per_worker: u128, )

As Self::materialize_dot_columns_with_workers, but with the work-per-worker threshold passed IN. See ScalarValues::materialize_dot_columns_with_policy.

br-frankenpandas-oarkz. A test fixture is thousands of times smaller than a benchmark frame, so under the shipped threshold every fixture would size itself down to one worker — and every “parallel arm” test in this file would quietly stop testing the parallel arm. Passing the threshold in is what keeps those tests honest, and it is the same in-process A/B hook the serial flag and the worker cap already have.

Source

pub fn as_f64_slice(&self) -> Option<&[f64]>

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 as_timedelta64_slice(&self) -> Option<&[i64]>

Borrow the raw &[i64] nanosecond backing of a Timedelta64 column. Sibling of Self::as_datetime64_slice (Timedelta64 stores its nanos in ColumnData::Timedelta64; there is no lazy Timedelta64 variant). Missing values are Timedelta::NAT in the buffer, so callers handle NaT inline. Returns None for any other dtype or a non-materialized column.

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_utf8_contiguous_arc(&self) -> Option<Utf8ArcBuffers>

Owned Arc handles to the same contiguous Utf8 backing that Self::as_utf8_contiguous exposes by reference.

perf/unblock (br-frankenpandas-vrjrf): as_utf8_contiguous hands back BORROWED (&[u8], &[usize]), which is the only reason the parallel string kernels must use std::thread::scope — the borrow may not outlive the call. The backing is already Arc<[u8]> / Arc<[usize]>, and Arc<T> is Send + Sync whenever T is, so returning CLONED Arcs instead lets a worker own its view for as long as it likes: no borrowed-slice lifetime, hence no scoped threads and no unsafe for the DATA side.

Both clones are O(1) refcount bumps, never buffer copies, and the backing is immutable after construction, so a reader can never observe a change underneath it.

Declines under exactly the same conditions as Self::as_utf8_contiguous (non-Utf8 dtype, any missing row, or a non-contiguous backing) and resolves the same two backings, so the two accessors agree row-for-row: row r is bytes[offsets[r]..offsets[r + 1]] under both.

NOTE for pool work: this removes the data-lifetime constraint but NOT the predicate one. A 'static worker pool also needs a 'static job, and the current apply_str_bool / apply_str_bytes_bool callers pass closures that BORROW their pattern (|s| s.contains(pat)). Making those 'static (owned pattern captures) is a separate, still-safe step — see the br-frankenpandas-vrjrf notes.

Source

pub fn as_nullable_utf8_contiguous(&self) -> Option<(&[u8], &[usize])>

Raw contiguous byte backing of a NULLABLE Utf8 column (LazyNullableUtf8 — a string column WITH missing rows). Returns (bytes, offsets) where a present row r is bytes[offsets[r]..offsets[r+1]] and a missing row’s span is empty; pair with Self::validity (validity.get(r) is false at missing rows) to distinguish present from missing without materializing the Vec<Scalar::Utf8>. None for any other backing (all-valid Utf8 uses Self::as_utf8_contiguous; eager/other dtypes have no contiguous span view). Sibling of as_utf8_contiguous for consumers that render/scan a nullable string column by span (e.g. the typed CSV/JSON writers).

Source

pub fn as_nullable_bool_slice(&self) -> Option<(&[bool], &ValidityMask)>

Raw packed &[bool] backing + validity of a NULLABLE Bool column (LazyNullableBool — a boolean column WITH missing rows). A present row r (validity.get(r)) is data[r]; a missing row’s datum is arbitrary (masked). None for any other backing (all-valid Bool uses Self::as_bool_slice; eager/other dtypes are excluded). Sibling of as_nullable_utf8_contiguous for consumers that render a nullable bool column by raw bit (e.g. the typed CSV/JSON writers).

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 clone the stored scalar exactly and rebuild validity from that scalar.

Row gather is a structural reorder, not a dtype-construction boundary: the output preserves the exact stored scalar/null kind at each selected source row, and recomputes validity from those gathered scalars.

§Panics

Panics if any position is out of bounds (callers materialize from validated index positions; this mirrors the prior values()[pos] index).

Source

pub fn take_contiguous_range(&self, start: usize, len: usize) -> Self

Gather a contiguous row range without first materializing start..start + len as a positions vector.

§Panics

Panics if the requested range overflows or extends beyond this column.

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 categorical(&self) -> Option<&CategoricalMetadata>

Source

pub fn with_categorical(&self, categorical: Option<CategoricalMetadata>) -> Self

Source

pub fn from_categorical_codes( codes: Vec<i32>, meta: CategoricalMetadata, ) -> Self

A categorical column whose row i is category codes[i] of meta (-1: missing), held as the codes (br-frankenpandas-5oup5).

Source

pub fn categorical_codes(&self) -> Option<&[i32]>

The category codes (-1: missing) of a column held as codes (Self::from_categorical_codes, a cut’s bins) while its categorical metadata names the categories they index; None for any other column.

Source

pub const fn width(&self) -> Option<NumericWidth>

The numpy dtype narrower than the storage that pandas reports for this column (int32, uint8, float32, …), or None for the storage’s own dtype (fvsao.23).

Source

pub fn keeping_dtype_of(self, source: &Self) -> Self

result, a structural operation’s output over source’s rows (a take, slice, reindex, concat), with source‘s dtype refinement where the result’s storage carries it - its width, and pandas’ string dtype over Utf8. An int32 column reindexed onto missing rows became float64, which is not int32’s storage, so it reports float64 as pandas does - and a numpy Int64 storage left holding a missing value is no numpy integer column either. The values are source’s, so already confined; a result holding new values goes through Self::narrowed_like. Public for a caller’s own gather of source’s rows (a typed fast path building the column itself); it must hold only source’s values.

Source

pub fn narrowed_like(self, source: &Self) -> Self

self, an operation’s result holding source’s values and maybe values it added (a fill, a bound, a row a join invented), in source’s width where pandas keeps it: carried where the storage can (see Self::keeping_dtype_of), then confined to it - float32 rounds, an integer width is dropped when an added value left its range.

Source

pub const fn is_pandas_string(&self) -> bool

Whether this is pandas’ string extension dtype over its Utf8 storage (fvsao.59).

Source

pub fn as_pandas_string(self) -> Self

This Utf8 column as pandas’ string dtype (the caller made its values text or missing); any other column unchanged.

Source

pub fn cast_to_width( &self, width: NumericWidth, nullable: bool, ) -> Result<Self, ColumnError>

This column as the numpy dtype width - astype('int8'), Series(..., dtype='float32') - over the nullable storage when nullable (pandas’ Int8 … Float32): the values are first cast to the storage as Self::astype casts them (text parsed, a float truncated toward zero, a missing value refused by a numpy integer target), then an integer width wraps each (astype('int8') of 300 is 44, astype('uint8') of -5 is 251) and float32 rounds each to the nearest f32.

§Errors

Self::astype’s; IntCastingNaN for a missing or infinite value cast to a numpy (not nullable) integer width; UInt64OutOfRange for a uint64 value at or above 2**63 (a negative value’s uint64 wrap), which the storage cannot hold.

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 scalar_at(&self, idx: usize) -> Option<Scalar>

The cell at idx (values()[idx]) without building the column’s Scalar view when its typed backing holds the cell (a single-cell or single-row read built the whole view; br-frankenpandas-rrulv). None past the end.

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_i64_int64_unit_ranges( &self, right: &Self, left_range: (i64, i64), right_range: (i64, i64), union_range: (i64, i64), op: ArithmeticOp, ) -> Result<Self, ColumnError>

Fused Float64-producing arithmetic for two Int64 columns aligned by contiguous Int64 unit ranges.

Outer alignment necessarily introduces a gap when indexes differ, so pandas widens the arithmetic result to Float64. This consumes the two typed Int64 buffers directly, avoiding both position vectors and the Scalar reindex/promotion round-trip.

Source

pub fn binary_scalar( &self, scalar: &Scalar, op: ArithmeticOp, scalar_left: bool, ) -> Option<Self>

self <op> scalar (scalar <op> self when scalar_left) without the scalar’s broadcast column (br-frankenpandas-pnxo5): for an all-valid Float64 column and a non-NaN number, + - * /, the column Self::aligned_binary_f64_same_positions makes of self and that broadcast; for an all-valid Int64 column and an Int64 scalar, + - *, the wrapping column Self::binary_numeric makes. A Float64 column ** a number is numpy’s power by one number (power_by_number), which that broadcast cannot give: an array of exponents is pow. None for anything else - the caller broadcasts.

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 an all-valid Bool column, with pandas’ numpy semantics: a missing operand (NaN, None, NaT) compares false, or true under !=. Only when an operand has a nullable extension dtype (Int64/Float64/boolean) is the result missing there, as pandas’ pd.NA propagates (br-frankenpandas-zwfz3: every missing operand gave a missing result).

Both columns must have the same length.

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 an all-valid Bool column under pandas’ numpy semantics: a missing element, or a missing scalar, compares false (true under !=). A nullable extension dtype keeps pd.NA propagation (see binary_comparison; br-frankenpandas-zwfz3).

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(). The rows of self then other, of one dtype; the result’s width is numpy’s for the pair (int8 then int16 is int16, int32 then int64 is int64), which holds every value of both.

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 all_valid_f64_chunk_sum(&self) -> Option<f64>

Sum of non-missing values.

Sum an all-valid Float64 concat(...) output (LazyAllValidFloat64Chunks) by folding each chunk slice in place with ONE 0.0-seeded accumulator in 0..n order — BIT-IDENTICAL to as_f64_slice().iter().sum() over the materialized buffer (same values, same order, same sequential left-fold) — but WITHOUT allocating+filling the cold concatenated Vec<f64> (the [[f64-arc-copy-on-produce]] ~5.7 ms/1M page-fault cost). None for any non-chunked / nullable / non-Float64 column (caller keeps its normal path).

Source

pub fn all_valid_f64_chunk_mean(&self) -> Option<f64>

Mean of an all-valid Float64 chunks column (see all_valid_f64_chunk_sum): Σ / len with the in-place chunk fold; None for empty or non-chunked.

Source

pub fn all_valid_i64_chunk_sum(&self) -> Option<i64>

Sum an all-valid Int64 concat(...) output by folding each chunk slice in place with wrapping_add (0-seeded, 0..n order) — BIT-IDENTICAL to the materialized as_i64_slice wrapping sum (wrapping_add is associative mod 2^64, so chunk grouping can’t change the result) — without the cold Vec.

Source

pub fn all_valid_i64_chunk_extreme(&self, want_max: bool) -> Option<i64>

Min/max of an all-valid Int64 concat output via in-place chunk fold (order-independent — i64::min/max is associative+commutative — so bit-identical to the materialized reduction). None if empty/non-chunked.

Source

pub fn all_valid_f64_chunk_extreme(&self, want_max: bool) -> Option<f64>

Min/max of an all-valid Float64 concat output via in-place chunk fold, replicating Series::max/min’s EXACT reduction — if v > result (seed −∞) / if v < result (seed +∞), NOT f64::max/min (which would flip ±0.0) — in 0..n order, so the ±0.0-first-seen tie is preserved bit-for-bit. Chunks are all-valid (no NaN), so no missing/NaN branch. None when empty/non-chunked (caller keeps its normal empty handling).

Source

pub fn all_valid_f64_chunk_slices(&self) -> Option<Vec<&[f64]>>

The chunk slices of an all-valid Float64 concat(...) output, in order, borrowed without materializing the concatenated buffer - for a reduction that reads the column in one global order (pandas’ pairwise sums; br-frankenpandas-9iim6). None for any other column.

Source

pub fn all_valid_i64_chunk_slices(&self) -> Option<Vec<&[i64]>>

Source

pub fn all_valid_f64_chunk_product(&self) -> Option<f64>

Product of an all-valid Float64 concat output, folding each chunk slice in place with a 1.0-seeded * in 0..n order — bit-identical to as_f64_slice().iter().product() (also a 1.0-seeded sequential left-fold) — without materializing the cold concat buffer.

Source

pub fn all_valid_i64_chunk_product(&self) -> Option<i64>

Int64 product sibling (wrapping_mul, associative mod 2^64 ⇒ grouping- invariant, bit-identical to the materialized fold(1, wrapping_mul)).

Source

pub fn all_valid_f64_chunk_argextreme(&self, want_max: bool) -> Option<usize>

Argmax/argmin (first-occurrence index) over an all-valid Float64 concat output, folding chunks in place. BIT-IDENTICAL to running f64_argmax_first_index/_min on the materialized buffer: that routine keeps an 8-lane running extreme where lane = position % 8, so iterating the chunks in 0..n order and updating lane[pos % 8] reproduces the exact same per-lane state, and the identical cross-lane reduction (max value, smallest index on ties = first occurrence) yields the same index — without materializing the cold buffer. None for empty/non-chunked.

Source

pub fn sum(&self) -> Scalar

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

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 pandas_reductions<R>( &self, reduce: impl FnOnce(&PandasReductions<'_>) -> R, ) -> Option<R>

This column as pandas’ float reductions read it (fp_types::PandasReductions: its values, which slots are present, and how pandas holds the missing ones), handed to reduce; None for a dtype they do not cover (temporal, text, object). Typed and chunked storage is read in place; a NaN in a float buffer is missing, as pandas reads it (br-frankenpandas-9iim6).

Source

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

Sample variance (ddof-parameterized).

Matches pd.Series.var(ddof=1): pandas’ nanvar (a masked dtype’s numpy var), its sums in numpy’s order (br-frankenpandas-9iim6).

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

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.

⚠️ pd.Series.has_duplicates does NOT exist (measured 2.2.3: AttributeError) – it is an Index property. The pandas spelling for values is s.duplicated().any(). FP superset, not parity.

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

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 holds_non_text(&self) -> bool

Whether this object (Utf8) column holds a present value that is not a string - an int of a mixed column, a list or host cell (fvsao.33). A text fast path that reads the column as &strs must decline such a column: it would read those cells as “” (fvsao.66).

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>

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
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§

§

impl !Freeze for Column

§

impl !RefUnwindSafe for Column

§

impl !UnwindSafe for Column

§

impl Send for Column

§

impl Sync for Column

§

impl Unpin for Column

§

impl UnsafeUnpin for Column

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.