Github user davies commented on a diff in the pull request: https://github.com/apache/spark/pull/6342#discussion_r30942066 --- Diff: python/pyspark/mllib/linalg.py --- @@ -821,6 +821,23 @@ def __reduce__(self): self.numRows, self.numCols, self.values.tostring(), int(self.isTransposed)) + def __str__(self): + mattoarr = self.toArray() + matstr = "" + for row in mattoarr: + for ind, col in enumerate(row): + if ind != 0: + matstr += " " + matstr += str(col) + matstr += '\n' --- End diff -- â+=â of string is slow, could you change to '\n'.join(' '.join(row) for row in self.toArray()
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org