<jupyter_start><jupyter_text>Mixed usage with other packagesThere are quite some excellent packages out there offering functionality around bucketing/binning/discretizing numerical variables and encoding categorical variables. Chances are you'd like to combine them in your `skorecard` pipelines.Here are some packages are are compatible with pandas dataframes:- [`category_encoders` from scikit-learn-contrib](https://github.com/scikit-learn-contrib/category_encoders)- [`feature-engine` categorical variable encoders](https://feature-engine.readthedocs.io/en/latest/encoding/index.html)- [`feature-engine` variable discretisation](https://feature-engine.readthedocs.io/en/latest/discretisation/index.html)<jupyter_code>%%capture
!pip install category_encoders
%%capture
from sklearn.pipeline import make_pipeline
from skorecard.datasets import load_uci_credit_card
from skorecard.bucketers import OrdinalCategoricalBucketer
X, y = load_uci_credit_card(return_X_y=True)

from category_encoders import TargetEncoder

pipe = make_pipeline(
    TargetEncoder(cols=["EDUCATION"]), #  category_encoders.TargetEncoder passes through other columns
    OrdinalCategoricalBucketer(variables=["MARRIAGE"])
)
pipe.fit(X, y)
pipe.transform(X).head(5)<jupyter_output><empty_output><jupyter_text>Some packages do not return pandas DataFrames, like:- [`sklearn.preprocessing.KBinsDiscretizer`](https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.KBinsDiscretizer.htmlsklearn.preprocessing.KBinsDiscretizer)You can wrap the class in `skorecard.pipeline.KeepPandas` to use these transformers in a pipeline:<jupyter_code>from sklearn.preprocessing import KBinsDiscretizer
from skorecard.pipeline import KeepPandas
from sklearn.compose import ColumnTransformer

ct = ColumnTransformer(
    [
        ("binner", KBinsDiscretizer(n_bins=3, encode='ordinal', strategy='uniform'), ['EDUCATION'])
    ],
    remainder="passthrough"
)
pipe = make_pipeline(
    KeepPandas(ct),
    OrdinalCategoricalBucketer(variables=["MARRIAGE"])
)
pipe.fit_transform(X, y).head(5)<jupyter_output>WARNING:root:sklearn.compose.ColumnTransformer can change the order of columns, be very careful when using with KeepPandas()
{'fraction_non_alphanumeric': 0.09627611262488647, 'fraction_numerical': 0.0013623978201634877, 'mean_word_length': 7.2819548872180455, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '77310', 'license': 'MIT', 'n_tokens_mistral': 680, 'n_tokens_neox': 660, 'n_words': 146, 'path': 'docs/howto/mix_with_other_packages.ipynb', 'repo_name': 'satya-pattnaik/skorecard', 'size': '2202'}