Registry / data / datasieve

datasieve

JSON →
library0.1.9pypypi✓ verified 86d ago

The `datasieve` package provides a flexible data pipeline inspired by scikit-learn's Pipeline, but with enhanced capabilities to manipulate `y` (target) and `sample_weight` arrays alongside `X` (features). This is particularly useful for tasks such as removing outliers across all associated data, removing feature columns based on arbitrary criteria, and handling dynamic feature renaming within the pipeline. The current version is 0.1.9, with releases occurring on an irregular, as-needed basis.

pip install datasieve
INSTALL
IMPORT
SIG · DATASIEVE
D
datasieve
datapythonv0.1.9
Install
13.5s avg
Import
4466ms
Disk
353MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.9 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
build_error
glibc
py 3.103.920 runs
installs and imports cleanly · install 13.5s · import 4.466s · 341MB
353MB installed
● package 353MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Pipeline
from datasieve.pipeline import Pipeline
transforms
import datasieve.transforms as dst
SKlearnWrapper
from datasieve.transforms import SKlearnWrapper

This example demonstrates how to build a `datasieve` pipeline using `Pipeline` and custom `transforms`. It includes `VarianceThreshold` to remove constant features, `SKlearnWrapper` to incorporate a `MinMaxScaler` from scikit-learn, `SVMOutlierExtractor` to identify and remove outliers (propagating removal to y and sample_weights), and `PCA` for dimensionality reduction. The example generates synthetic data with a constant feature and outliers to showcase the pipeline's capabilities.

import pandas as pd from datasieve.pipeline import Pipeline import datasieve.transforms as dst from sklearn.preprocessing import MinMaxScaler import numpy as np # Create sample data X_data = pd.DataFrame(np.random.rand(100, 5), columns=[f'feature_{i}' for i in range(5)]) y_data = pd.Series(np.random.randint(0, 2, 100)) sample_weights = np.random.rand(100) # Introduce some zero-variance feature and outliers for demonstration X_data['feature_0'] = 1.0 # Zero variance X_data.iloc[0:5, 1] = 1000.0 # Outliers # Build the datasieve pipeline feature_pipeline = Pipeline([ ("detect_constants", dst.VarianceThreshold(threshold=0)), # Removes zero-variance features ("pre_svm_scaler", dst.SKlearnWrapper(MinMaxScaler(feature_range=(-1, 1)))), ("svm_outlier_extractor", dst.SVMOutlierExtractor(nu=0.1, kernel='rbf')), ("pca", dst.PCA(n_components=0.95)) # Dimensionality reduction ]) # Fit and transform the data X_transformed, y_transformed, sample_weights_transformed = \ feature_pipeline.fit_transform(X_data.copy(), y_data.copy(), sample_weights.copy()) print("Original X shape:", X_data.shape) print("Transformed X shape:", X_transformed.shape) print("Original y length:", len(y_data)) print("Transformed y length:", len(y_transformed)) print("Transformed X (first 5 rows):\n", X_transformed.head() if isinstance(X_transformed, pd.DataFrame) else X_transformed[:5])
Debug
Known issues
gotchaInput data (X, y, sample_weight) must maintain consistent row order and indices if DataFrames/Series are used. `datasieve` transforms operate on the assumption of this consistency, especially when removing rows (e.g., outliers) to propagate changes correctly across all inputs.
fix
Ensure that `X`, `y`, and `sample_weight` (if applicable) are aligned by index before passing them to `fit_transform` or `transform`. If using NumPy arrays, ensure the row order is consistent.
affects: All versions
gotchaMismatch in the number or names of features between `fit` and `transform` calls can lead to errors, particularly after feature selection or dimensionality reduction steps within the pipeline.
fix
Ensure that the input data for `transform` (e.g., test set) has the same feature set and order as the data used for `fit` (e.g., training set). `datasieve` handles feature renaming internally (e.g., after PCA), but initial input consistency is crucial. Pre-processing steps outside the pipeline should be consistently applied.
affects: All versions
Errors
Common errors & fixes
No module named 'datasieve'
The datasieve library is not installed in the current Python environment.
fix
Run `pip install datasieve` to install the package. If using a virtual environment, ensure it is activated before installation.
Exception: Pipeline expected Index(...) but got Index(...)
This error typically occurs when the column names (features) of the input data to a pipeline step do not match the expected features that the step was fitted on. This often happens if columns are dropped or renamed unexpectedly between `fit` and `transform` calls, or if the test set has different columns than the training set.
fix
Verify that the feature names (column names if using pandas DataFrames) of the data being passed through the pipeline are consistent with what the pipeline expects based on its `fit` operation. Ensure that any manual feature engineering or selection outside the `datasieve` pipeline is applied consistently to both training and test data.
Upgrade
Version history
0.1.9latest on PyPI · released May 11, 2025
Audit
Dependencies
scikit-learnrequiredCore functionality is built on and extends scikit-learn's API and transformers.
pandasoptionalRecommended for convenient handling of DataFrame inputs and maintaining column names throughout the pipeline.
Agent activity
18 hits · last 30 days
node
14
OpenAI (training)
1
Resources
datasieve — pip install datasieve · libregistry