问题 Summing over one axis of a scipy.sparse.csr_matrix results in a numpy.matrix object. Given that my sparse matrix is really sparse, I find extremely annoying this behaviour. Here is an example: dense = [[ 0., 0., 0., 0., 0.], [ 1., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.], [ 0., 0., 0., 0., 0.], [ 2., 0., 4., 0., 0.]] from scipy.sparse import csr_matrix sparse = csr_matrix(dense) print(sparse.sum(1)) with result: matrix([[ 0.], [ 1.], [ 0.], [ 0.], [ 6.]]) How can I enforce sparseness in the sum