Helpful Package For Custom Transformers To Use In Sklearn Pipelines
Installation
pip install scikit-learn-pipeline-utils
Quick Start
from sklearn_pipeline_utils import DFSelector
from sklearn.pipeline import Pipeline
import pandas as pd
df = pd.DataFrame({
"col1": ["a", "b", "a"],
"col2": [1, 2, 3]
})
pipeline = Pipeline([
("dfselectcol1", DFSelector("col1"))
])
print(pipeline.transform(df))
'''
expected result:
col1
0 a
1 b
2 a
'''
Dataframe Transformers List
- DFSelector
- DFObjectSelector
- DFFeatureUnion
- DFImputer
- DFImputerMostFrequent
- DFOrdinalEncoder
- DFStandardScaler