code: def value_counts(arg, metric_name='count'):
      
      base = ir.find_base_table(arg)
      metric = base.count().name(metric_name)
  
      try:
          arg.get_name()
      except com.ExpressionError:
          arg = arg.name('unnamed')
  
      return base.group_by(arg).aggregate(metric)
docs: Compute a frequency table for this value expression
  
      Parameters
      ----------
  
      Returns
      -------
      counts : TableExpr
        Aggregated table