docstr: Sets the attribute counts to equal the bincount of the (integer-valued)
  labels.
docstr_tok: ["Sets","the","attribute","counts","to","equal","the","bincount","of","the","(","integer-valued",")","labels","."]
code: def count_categories(self, level=0):
      """
      Sets the attribute counts to equal the bincount of the (integer-valued)
      labels.
      """
      # TODO: refactor this not to set an attribute. Why would we do this?
      self.counts = np.bincount(self.labels[level])
  
imports: from statsmodels.compat.python import lrange, lzip
  import numpy
  import pandas
  import statsmodels.tools.data
  from pandas import Index, MultiIndex
label_desc: Use image node_id 8 for calling the Grouping obj's underlying member method code with example usage: obj.count_categories(level) without return types