code: def grouppivot(labelgroup, yvalue, dataset, SZonly=False):
      # Select only columns with a SZ diagnosis
      if SZonly:
          dataset = dataset.loc[dataset.Diagnosis == 0]
  
      # Group by label group, and normalize by y value within those groups
      grouped = (
          dataset.groupby([labelgroup])[yvalue]
          .value_counts(normalize=True)
          .rename("percentage")
          .reset_index()
      )
  
      pivot = pd.pivot_table(
          grouped,
          index=labelgroup,
          columns=yvalue,
          values="percentage",
          aggfunc="sum",
      )
      return pivot
  
file_path: fairlearn/examples/plot_intersectional_bias.py
imports: import numpy
  import pandas
  import matplotlib.pyplot
  import sklearn.metrics
  import seaborn
  from sklearn.datasets import fetch_openml
  from sklearn.preprocessing import OneHotEncoder, MinMaxScaler
  from sklearn.linear_model import LogisticRegression
  from fairlearn.metrics import MetricFrame, false_positive_rate
label_desc: Use image node_id 1 for calling a global function with example usage: grouppivot(labelgroup, yvalue, dataset, SZonly) and returns: pivot