code: def __create_population_bar_df(attribute_df, metric):
      """Creates a pandas aggregation of the attribute_df by parity result, along with the
      list of groups tooltip variable."""
  
      attribute_df["group_size_formatted"] = attribute_df.apply(
          lambda row: format_number(row["group_size"]), axis=1
      )
      attribute_df["tooltip_groups_name_size"] = (
          attribute_df["attribute_value"]
          + " ("
          + attribute_df["group_size_formatted"].astype(str)
          + ")"
      )
      population_bar_df = (
          attribute_df.groupby(by=f"{metric}_parity_result")
          .agg(
              {
                  "attribute_name": min,
                  "total_entities": min,
                  "group_size": sum,
                  "tooltip_groups_name_size": lambda x: ", ".join(x),
              }
          )
          .reset_index()
      )
  
      population_bar_df["tooltip_group_size"] = population_bar_df.apply(
          lambda row: get_tooltip_text_group_size(
              row["group_size"], row["total_entities"]
          ),
          axis=1,
      )
  
      return population_bar_df
  
imports: import altair
  import pandas
  from aequitas.plot.commons.helpers import no_axis, transform_ratio, format_number, get_chart_metadata
  from aequitas.plot.commons.tooltips import get_tooltip_text_group_size, get_tooltip_text_disparity_explanation, get_tooltip_text_parity_test_explanation
  from aequitas.plot.commons.style.classes import Title, Subtitle, Parity_Result, Annotation, Legend
  from aequitas.plot.commons.style.text import FONT
  from aequitas.plot.commons.style.sizes import Summary_Chart
  from aequitas.plot.commons import initializers
  from aequitas.plot.commons import validators
  from aequitas.plot.commons import labels
label_desc: Use image node_id 10 for calling a global function with example usage: __create_population_bar_df(attribute_df, metric) and returns: population_bar_df