Github user holdenk commented on a diff in the pull request:
https://github.com/apache/spark/pull/15496#discussion_r86468088
--- Diff: python/pyspark/ml/linalg/__init__.py ---
@@ -705,6 +705,22 @@ def __eq__(self, other):
return Vectors._equals(self.indices, self.values,
list(xrange(len(other))), other.array)
return False
+ def __getattr__(self, item):
+ def wrapper(*args, **kwargs):
+ if _have_scip:
+ csr = scipy.sparse.csr_matrix((\
+ np.append(self.values, 0),\
+ np.append(self.indices,
self.size-1),\
+ [0, len(self.values)]))
+ func = getattr(csr, item)
+ result = func(*args, **kwargs)
+ if isinstance(result, scipy.sparse.csr.csr_matrix):
+ return
SparseVector(result.shape[1],result.indices,result.data)
+ return result
+ else:
+ raise AttributeError("'{0}' object has no attribute
'{1}'.".format(self.__class__, item))
--- End diff --
This seems like it might be kind of a confusing way to communicate that the
user doesn't have scipy installed
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]