code: def fetch_german(
      *,
      data_home=None,
      cache=True,
      binary_age=True,
      usecols=None,
      dropcols=None,
      numeric_only=False,
      dropna=True,
  ):
      """Load the German Credit Dataset.
  
      Protected attributes are 'sex' ('male' is privileged and 'female' is
      unprivileged) and 'age' (binarized by default as recommended by
      [#kamiran09]_: age >= 25 is considered privileged and age < 25 is considered
      unprivileged; see the binary_age flag to keep this continuous). The outcome
      variable is 'credit-risk': 'good' (favorable) or 'bad' (unfavorable).
  
      Note:
          By default, the data is downloaded from OpenML. See the `credit-g
          <https://www.openml.org/d/31>`_ page for details.
  
      Args:
          data_home (string, optional): Specify another download and cache folder
              for the datasets. By default all AIF360 datasets are stored in
              'aif360/sklearn/data/raw' subfolders.
          cache (bool): Whether to cache downloaded datasets.
          binary_age (bool, optional): If ``True``, split protected attribute,
              'age', into 'aged' (privileged) and 'youth' (unprivileged). The
              'age' feature remains continuous.
          usecols (list-like, optional): Column name(s) to keep. All others are
              dropped.
          dropcols (list-like, optional): Column name(s) to drop.
          numeric_only (bool): Drop all non-numeric feature columns.
          dropna (bool): Drop rows with NAs.
  
      Returns:
          namedtuple: Tuple containing X and y for the German dataset accessible
          by index or name.
  
      See also:
          :func:`sklearn.datasets.fetch_openml`
  
      References:
          .. [#kamiran09] `F. Kamiran and T. Calders, "Classifying without
             discriminating," 2nd International Conference on Computer,
             Control and Communication, 2009.
             <https://ieeexplore.ieee.org/abstract/document/4909197>`_
  
      Examples:
          >>> german = fetch_german()
          >>> german.X.shape
          (1000, 21)
  
          >>> german_num = fetch_german(numeric_only=True)
          >>> german_num.X.shape
          (1000, 7)
  
  
  
          >>> X, y = fetch_german(numeric_only=True)
          >>> y_pred = LogisticRegression().fit(X, y).predict(X)
          >>> disparate_impact_ratio(y, y_pred, prot_attr='age', priv_group=True,
          ... pos_label='good')
          0.9483094846144106
      """
      df = fetch_openml(
          data_id=31,
          data_home=data_home or DATA_HOME_DEFAULT,
          cache=cache,
          as_frame=True,
      ).frame
  
      df = df.rename(
          columns={"class": "credit-risk"}
      )  # more descriptive name
      df["credit-risk"] = df["credit-risk"].cat.reorder_categories(
          ["bad", "good"], ordered=True
      )
  
      # binarize protected attribute (but not corresponding feature)
      age = (
          pd.cut(
              df.age,
              [0, 25, 100],
              labels=False if numeric_only else ["young", "aged"],
          )
          if binary_age
          else "age"
      )
  
      # Note: marital_status directly implies sex. i.e. 'div/dep/mar' => 'female'
      # and all others => 'male'
      personal_status = df.pop("personal_status").str.split(expand=True)
      personal_status.columns = ["sex", "marital_status"]
      df = df.join(personal_status.astype("category"))
      df.sex = df.sex.cat.reorder_categories(
          ["female", "male"], ordered=True
      )
  
      df.foreign_worker = df.foreign_worker.astype(
          "category"
      ).cat.set_categories(["no", "yes"], ordered=True)
  
      return standardize_dataset(
          df,
          prot_attr=["sex", age, "foreign_worker"],
          target="credit-risk",
          usecols=usecols,
          dropcols=dropcols,
          numeric_only=numeric_only,
          dropna=dropna,
      )
  
imports: import os
  import pandas
  from sklearn.datasets import fetch_openml
  from aif360.sklearn.datasets.utils import standardize_dataset
label_desc: Use image node_id 2 for calling a global function with example usage: fetch_german() and returns: standardize_dataset