I want to apply pd.cut as a transformer in a pipeline, like this:
numerical_preprocessing = Pipeline([
('cut_into_bins', FunctionTransformer(pd.cut, kw_args={'bins': [10, 100, 1000]})
)]
However, I get an error: ValueError("Input array must be 1 dimensional")
I could just write the same function over and over again with each column separately, but that looks like a terrible coding practice. Any thoughs on this?