aif360.sklearn.datasets.fetch_bank(data_home=None, percent10=False, usecols=[], dropcols='duration', numeric_only=False, dropna=False)[source]

Load the Bank Marketing Dataset.

The protected attribute is ‘age’ (left as continuous). The outcome variable is ‘deposit’: ‘yes’ or ‘no’.


By default, the data is downloaded from OpenML. See the bank-marketing page for details.

  • 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.
  • percent10 (bool, optional) – Download the reduced version (10% of data).
  • usecols (single label or list-like, optional) – Column name(s) to keep. All others are dropped.
  • dropcols (single label or list-like, optional) – Column name(s) to drop.
  • numeric_only (bool) – Drop all non-numeric feature columns.
  • dropna (bool) – Drop rows with NAs. Note: this is False by default for this dataset.

namedtuple – Tuple containing X and y for the Bank dataset accessible by index or name.


>>> bank = fetch_bank()
>>> bank.X.shape
(45211, 15)
>>> bank_nona = fetch_bank(dropna=True)
>>> bank_nona.X.shape
(7842, 15)
>>> bank_num = fetch_bank(numeric_only=True)
>>> bank_num.X.shape
(45211, 6)