Is it possible to change pandas column data type within a sklearn pipeline? Sklearn pipeline I am using has multiple transformers but one of the initial transformers returns numerical type and the consecutive one takes object type variables.

Basically I need squeeze in a:

data[col] = data[col].astype(object)


for the required columns within the pipeline.

Is there any way to do it?

Note: I am using Feature-engine transformers.
You sure can.

One solution off the bat is to extend your estimator that 
 takes object type variables. So what does that mean.

Library that you said are all estimators in the sklearn form fit, predict methodology. So all you have to do is something as follows:

&gt; class modifiedTraf(oldTraf):
&gt;        def __init__(self):
&gt;           super(modifiedTraf, self).__init__():
&gt; 
&gt; bla bla   
&gt; 
&gt;       def fit(self, X):
&gt;           X[col] = X[col].astype(object)
&gt;           super(modifiedTraf,self).fit(X)
&gt;           return self
&gt;       def transform(self, X):
&gt;           X[col] = X[col].astype(object)
&gt;           X=super(modifiedTraf,self).transform(X)
&gt;           return X


Learn more about overriding sklearn classes and super argument for example here