If you use polynomial features
with degree of 2 then only from 2 features it can create features like e.g. features: a and b. Then the polynomial features will be: a^2, b^2, 2*a*b
and if you have 3 features then it will create a^2, b^2, c^2, 2ab, 2ac, 2bc
.
So, now as you have 10 features, then it should create 10! / [2!(10-2)!] = 45 new features. If you are getting more than 45 new features(in total it should be 55, but you will get 45 because you have used include_bias=False
).
So, please check shape
of the dataset using: X.shape
before feeding it to the polynomial function. It should be 10 if you want 45 features, and it will be more than 10 if you are getting more than 100 new features.
To get only the degree columns, as you mentioned in the comments, you can create a new dataframe and put all your new columns in it and use the new dataframe instead of the old one. So in summary, in the new dataframe you will have all the new columns and in the old dataframe you will have only the old columns. Or you can select only those columns from your dataframe that you are interested in, like this:
df = df[['a2', 'b2', '2ab']]