code: def get_top_categories(entries_list, bins, top_n):
      # get the top top_n rows
      row_sum = np.sum(entries_list, axis=1).ravel().tolist()
      sorted_index = np.argsort(row_sum).tolist()
      top_rows = entries_list[sorted_index[-top_n:], :]
  
      # aggregate all other rows
      bottom_rows = entries_list[sorted_index[:-top_n], :]
      bottom_row = np.sum(bottom_rows, axis=0).ravel().tolist()
      # append alll other aggregated row to top_rows
      top_rows = np.append(top_rows, [bottom_row], axis=0)
  
      # select the corresponding bins/labels
      bins = [bins[i] for i in sorted_index[-top_n:]]
      # add 'others' label
      bins.append("Others")
  
      return top_rows, bins
  
file_path: popmon/popmon/visualization/histogram_section.py
imports: from __future__ import annotations
  import numpy
  import pandas
  from histogrammar.util import get_hist_props
  from tqdm import tqdm
  from popmon.analysis.hist_numpy import assert_similar_hists, get_consistent_numpy_1dhists, get_consistent_numpy_entries
  from popmon.base import Module
  from popmon.config import HistogramSectionModel
  from popmon.utils import parallel, short_date
  from popmon.visualization.utils import histogram_basic_checks, plot_heatmap, plot_histogram_overlay
label_desc: Use image node_id 3 for calling a global function with example usage: get_top_categories(entries_list, bins, top_n) and returns: top_rows,  bins