def _cumcount_array(self, ascending=True):
ids, _, ngroups = self.grouper.group_info<EOL>sorter = get_group_index_sorter(ids, ngroups)<EOL>ids, count = ids[sorter], len(ids)<EOL>if count == <NUM_LIT:0>:<EOL><INDENT>return np.empty(<NUM_LIT:0>, dtype=np.int64)<EOL><DEDENT>run = np.r_[True, ids[:-<NUM_LIT:1>] != ids[<NUM_LIT:1>:]]<EOL>rep = np.diff(np.r_[np.nonzero(run)[<NUM_LIT:0>], count])<EOL>out = (~run).cumsum()<EOL>if ascending:<EOL><INDENT>out -= np.repeat(out[run], rep)<EOL><DEDENT>else:<EOL><INDENT>out = np.repeat(out[np.r_[run[<NUM_LIT:1>:], True]], rep) - out<EOL><DEDENT>rev = np.empty(count, dtype=np.intp)<EOL>rev[sorter] = np.arange(count, dtype=np.intp)<EOL>return out[rev].astype(np.int64, copy=False)<EOL>
Parameters
----------
ascending : bool, default True
    If False, number in reverse, from length of group - 1 to 0.

Notes
-----
this is currently implementing sort=False
(though the default is sort=True) for groupby in general