Reply
Highlighted
New Contributor
Posts: 1
Registered: ‎11-20-2017

PYSPARK Return feature names after PolynomialExpansion

Hello,

I would like to retrieve the column names created after using PolynomialExpansion.
My code is:

px = PolynomialExpansion(degree=2, inputCol="features_num_var", outputCol="polyFeatures")
polyDF = px.transform(output)

polyDF contains the column vectors created but I would like to separate the vector into columns with the associated name.

In python with the PolynomialFeatures method there is get_feature_names, is there an equivalent in spark?

thank you in advance
 

 

Announcements