Colnade¶
A statically type-safe DataFrame abstraction layer for Python.
Colnade replaces string-based column references (pl.col("age")) with typed descriptors (Users.age), so column misspellings, type mismatches, and schema violations are caught by your type checker — before your code runs.
Works with ty, mypy, and pyright. No plugins, no code generation.
Quick Example¶
Key Features¶
- Type-safe column references —
Users.naemis a type error, not a runtime crash - Schema-preserving operations —
filter,sort,with_columnspreserveDataFrame[S] - Typed expressions —
Users.age > 18producesExpr[Bool],Users.score * 2producesExpr[Float64] - Backend agnostic — works with Polars today, with adapters for other engines
- Generic utility functions — write
def f(df: DataFrame[S]) -> DataFrame[S]that works with any schema - Struct and List support — typed access to nested data structures
- No plugins or codegen — works with standard type checkers out of the box