Consider the following artificial data:
data = pd.DataFrame({'pet':['cat', 'dog', 'dog', 'fish',
'cat', 'dog', 'cat', 'fish'],
'children': [4., 6, 3, 3, 2, 3, 5, 4],
'salary': [90., 24, 44, 27, 32, 59, 36, 27]})
In sklearn ColumnTransformer
, I can drop any column I want by specifying 'drop'
as the transformer as follows:
clmn_trnsfrmr = ColumnTransformer([
('clmn_drpr', 'drop', ['pet'])]),
('scale', StandardScaler(), ['salary']),
'passthrough'])
Is there a similar way in sklearn-pandas
DataFrameMapper
to drop exactly the column I want?