def apply(self, func):
        self.matrix.eliminate_zeros()
        mat = self.matrix.tocoo()
        mat.data = func(mat.data)
        return self._new_instance(mat)
Apply function func element-wise on numpy.ndarray of non-zero values.
dataset/ETHPy150Open jimmycallin/pydsm/pydsm/indexmatrix.py/IndexMatrix.apply