Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
generates polynomial features out of any
from sklearn.preprocessing import PolynomialFeatures
p = PolynomialFeatures(degree=2).fit(df[['feature1','feature2]])
features = pd.DataFrame(p.transform(df[['feature1','feature2]]), columns=p.get_feature_names(df[['feature1','feature2]].columns))
features.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.