I am working with pyspark. I converted the features VectorAssembler with following code
from pyspark.ml.feature import VectorAssembler
assembler = VectorAssembler(inputCols=list(df.columns[1::]), outputCol='features')
transformed_data = assembler.transform(df)
After that I scaled the data
from pyspark.ml.feature import StandardScaler
Scalerizer=StandardScaler().setInputCol("features").setOutputCol("Scaled_features")
scaled_data=Scalerizer.fit(transformed_data).transform(transformed_data)
Now I want to do feature selection. But the VarianceThreshold techniuqe is not available.
But I know the code of it
var=np.nanvar(df,axis=0)
var=(var>threshold)
df[:,var]
But I have no clue how to implement it on spark dataframe