grizz

raw JSON →
0.1.1 verified Mon Apr 27 auth: no python

A lightweight library for preprocessing data with Polars. Version 0.1.1 supports Python 3.9-3.13 and dependencies include Polars, PyArrow, and ClickHouse. Releases are frequent, adding transformers and temporal features.

pip install grizz
error ModuleNotFoundError: No module named 'grizz.transformer.ts'
cause The `ts` submodule was removed in v0.0.3 when temporal transformers were moved up.
fix
Use from grizz.transformer import ToDatetimeTransformer instead.
error TypeError: 'columns' must be a list of strings
cause Passing a single string to `columns` instead of a list.
fix
Wrap the column name in a list: columns=['col_name'].
error polars.exceptions.ComputeError: conversion from `str` to `i64` failed
cause Casting a non-numeric string to an integer type.
fix
Ensure all values in the column are numeric, or use FloatCastTransformer for floats.
breaking In v0.0.5, the `period` parameter was renamed to `interval` in several transformers (e.g., CumSumTransformer, CumMeanTransformer). Code using `period` will break.
fix Replace `period` with `interval` in transformer constructors.
breaking The `ToTimeTransformer` and `ToDatetimeTransformer` were moved from `grizz.transformer.ts` to `grizz.transformer` in v0.0.3. Old imports will fail.
fix Update imports: `from grizz.transformer import ToTimeTransformer`.
gotcha Transformer base class methods `transform` and `fit_transform` expect Polars DataFrames. Passing pandas DataFrames will raise a TypeError.
fix Convert pandas DataFrame to Polars using `pl.from_pandas(df)` before passing.

Create a Polars DataFrame and apply a CastTransformer to cast column 'a' to Int64.

import polars as pl
from grizz.transformer import CastTransformer

df = pl.DataFrame({'a': ['1', '2'], 'b': ['3.0', '4.0']})
transformer = CastTransformer(columns=['a'], dtype=pl.Int64)
result = transformer.fit_transform(df)
print(result)