python - Pyspark converting RowMatrix to DataFrame or RDD -


i have square pyspark rowmatrix looks this:

>>> row_mat.numrows() 100 >>> row_mat.numcols() 100 >>> row_mat.rows.first() sparsevector(100, {0: 0.0, 1: 0.0018, 2: 0.1562, 3: 0.0342...}) 

i run pyspark.ml.feature.pca, fit() method takes in dataframe. there way convert rowmatrix dataframe?

or there better way it?

use:

row_mat.rows.map(lambda x: (x, )).todf() 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -