Pipeline heterogeneous data
Approach 1: create features before transforming

If you want to create a categorical variable based on a numerical variable and then treat it in cat_pipeline, you need to do create it before the column transformer.

Implement a transformer (called "bucketer" ?) that takes p variables and transforms it into p+1 (if you want to add the categorical representation and keep the initial numerical feature). This transformer is the FIRST step of your pipe.

Then, create a ColumnTransformer (I think it is more suited for your case, but have not enough details to be sure. I suggest you read this to be sure). This second transformation is the second step in your pipe.

Each branch is fed with respect to what it should output because feature creation (bucketing) was done prior to column transformer.



Approach 2: create features in transforming

Otherwise, you can create two main paths :


One branch will output only categorical features, whatever the input type.
The other will output only numerical features, whatever the input type.




You may want to re-use your feature selector in some branches, I just wanted to illustrate the two possible approaches 

Hope this helps