Skip to main content

nexcore_dataframe/
lib.rs

1//! # nexcore-dataframe
2//!
3//! Sovereign columnar DataFrame engine for NexCore.
4//!
5//! Zero unsafe code, zero external DataFrame dependency.
6//! Replaces polars across the workspace, eliminating CRITICAL (fast-float segfault)
7//! and HIGH (pyo3 buffer overflow) transitive vulnerabilities.
8//!
9//! ## Core types
10//!
11//! - [`DataFrame`] — columnar table with named, typed columns
12//! - [`Column`] — named array of homogeneous nullable values
13//! - [`Scalar`] — single typed value for comparisons and aggregation results
14//! - [`Counter`] — optimized hash-based group-count (replaces polars group_by+count)
15//! - [`Schema`] — column name → type mapping
16//!
17//! ## Operations
18//!
19//! - Filter: `df.filter(&mask)`, `df.filter_by("col", |v| pred)`
20//! - Sort: `df.sort("col", descending)`, `df.head(n)`, `df.tail(n)`
21//! - Select: `df.select(&["col1", "col2"])`, `df.drop_columns(&["col"])`
22//! - Aggregate: `col.sum()`, `col.mean()`, `col.min()`, `col.max()`, `col.median()`
23//! - GroupBy: `df.group_by(&["col"])?.agg(&[Agg::Sum("val".into())])`
24//! - Join: `df.join(&other, &["key"], JoinType::Inner)` (inner/left/right/outer/semi/anti)
25//! - I/O: `DataFrame::from_json(s)`, `df.to_json()`, `df.to_json_file(path)`
26
27#![forbid(unsafe_code)]
28#![warn(missing_docs)]
29#![cfg_attr(
30    not(test),
31    deny(clippy::unwrap_used, clippy::expect_used, clippy::panic)
32)]
33
34// Core types
35pub mod column;
36pub mod dataframe;
37pub mod error;
38pub mod scalar;
39pub mod schema;
40
41// Operations
42pub mod agg;
43pub mod counter;
44pub mod filter;
45pub mod group;
46pub mod join;
47pub mod select;
48pub mod sort;
49
50// I/O
51pub mod io;
52
53// Re-exports for ergonomic use
54pub use column::{Column, ColumnData, DataType};
55pub use counter::Counter;
56pub use dataframe::DataFrame;
57pub use error::DataFrameError;
58pub use group::Agg;
59pub use join::JoinType;
60pub use scalar::Scalar;
61pub use schema::Schema;
62
63/// Prelude: import everything needed for typical DataFrame usage.
64pub mod prelude {
65    pub use crate::column::{Column, DataType};
66    pub use crate::counter::Counter;
67    pub use crate::dataframe::DataFrame;
68    pub use crate::error::DataFrameError;
69    pub use crate::group::Agg;
70    pub use crate::join::JoinType;
71    pub use crate::scalar::Scalar;
72    pub use crate::schema::Schema;
73}