0

how can I convert a CoordinateMatrix to a Pyspark Dataframe?

I have tried to convert my dataframe to a rowmatrix and then to a dataframe using this df.toRowMatrix().rows.map(lambda x: (x, )).toDF() but it looks really weird.

|                  _1|
+--------------------+
|(100,[20,21,22,23...|
|(100,[40,41,42,43...|
|(100,[35,36,37,38...|
|(100,[5,6,7,8,9,1...|

Would appreciate any help, thanks!

Johnas
  • 296
  • 2
  • 5
  • 15
  • Can you provide a code example for what your CoordinateMatrix looks like? Also, can you describe what you expect the resulting DataFrame to look like? – David Jan 08 '23 at 23:58

0 Answers0