def test_toRowMatrix(self): from lambdaimage.rdds.matrices import RowMatrix rdd = self.sc.parallelize([(0, array([4, 5, 6, 7])), (1, array([8, 9, 10, 11]))]) data = Series(rdd) mat = data.toRowMatrix() assert(isinstance(mat, RowMatrix)) assert(mat.nrows == 2) assert(mat.ncols == 4) # check a basic operation from superclass newmat = mat.applyValues(lambda x: x + 1) out = newmat.collectValuesAsArray() assert(array_equal(out, array([[5, 6, 7, 8], [9, 10, 11, 12]])))