def toArray ( self ) : arr = np . zeros ( ( self . size , ) , dtype = np . float64 ) arr [ self . indices ] = self . values return arr
python sparse array numpy dask
Returns a copy of this SparseVector as a 1 - dimensional NumPy array .
def toArray(self):
        """
        Returns a copy of this SparseVector as a 1-dimensional NumPy array.
        """
        arr = np.zeros((self.size,), dtype=np.float64)
        arr[self.indices] = self.values
        return arr