From b8e1e6e6dbf213bb16db29d0cae632f3c4e60e92 Mon Sep 17 00:00:00 2001 From: Vinod K C Date: Thu, 10 Sep 2015 12:56:21 +0530 Subject: [PATCH 1/2] Added values property --- python/pyspark/mllib/linalg/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/pyspark/mllib/linalg/__init__.py b/python/pyspark/mllib/linalg/__init__.py index 334dc8e38bb8f..4aa2fa4af4848 100644 --- a/python/pyspark/mllib/linalg/__init__.py +++ b/python/pyspark/mllib/linalg/__init__.py @@ -266,6 +266,7 @@ def __init__(self, ar): if ar.dtype != np.float64: ar = ar.astype(np.float64) self.array = ar + self.values = ar @staticmethod def parse(s): From b77e420ed0d737e99c763cb7150949a0f0ec9e11 Mon Sep 17 00:00:00 2001 From: Vinod K C Date: Wed, 16 Sep 2015 11:56:05 +0530 Subject: [PATCH 2/2] Fixed review comment --- python/pyspark/mllib/linalg/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/pyspark/mllib/linalg/__init__.py b/python/pyspark/mllib/linalg/__init__.py index 4aa2fa4af4848..675af97c00c89 100644 --- a/python/pyspark/mllib/linalg/__init__.py +++ b/python/pyspark/mllib/linalg/__init__.py @@ -266,7 +266,6 @@ def __init__(self, ar): if ar.dtype != np.float64: ar = ar.astype(np.float64) self.array = ar - self.values = ar @staticmethod def parse(s): @@ -392,6 +391,10 @@ def squared_distance(self, other): def toArray(self): return self.array + @property + def values(self): + return self.array + def __getitem__(self, item): return self.array[item]