def getnnz(self, axis=None):
if axis is None:<EOL><INDENT>return int(self.indptr[-<NUM_LIT:1>])<EOL><DEDENT>else:<EOL><INDENT>if axis < <NUM_LIT:0>:<EOL><INDENT>axis += <NUM_LIT:2><EOL><DEDENT>axis, _ = self._swap((axis, <NUM_LIT:1> - axis))<EOL>_, N = self._swap(self.shape)<EOL>if axis == <NUM_LIT:0>:<EOL><INDENT>return _compat_bincount(downcast_intp_index(self.indices),<EOL>minlength=N)<EOL><DEDENT>elif axis == <NUM_LIT:1>:<EOL><INDENT>return np.diff(self.indptr)<EOL><DEDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>
Get the count of explicitly-stored values (nonzeros)

        Parameters
        ----------
        axis : None, 0, or 1
            Select between the number of values across the whole matrix, in
            each column, or in each row.