code: def load_energy_mix(year=2019, normalize=True):
      """Per capita energy mix by country in 2019.
  
      Each row corresponds to a country. There is one column for each energy source.
      A value corresponds to the average energy consumption of a source per capita.
      For instance, in France, every citizen consumed 15,186 kWh of nuclear energy.
  
      This data comes from https://ourworldindata.org/energy-mix
  
      Parameters
      ----------
      year
          The year the study was made.
      normalize
          Whether or not to normalize the kWh by country.
  
      """
  
      df = (
          pd.read_csv(DATASETS_DIR / "per-capita-energy-stacked.csv")
          .query("Year == @year")
          .query(
              "Entity not in ['Africa', 'Europe', 'North America', 'World']"
          )
          .drop(columns=["Code", "Year"])
          .rename(columns={"Entity": "Country"})
          .rename(
              columns=lambda x: x.replace(
                  " per capita (kWh)", ""
              ).lower()
          )
          .set_index(["continent", "country"])
      )
      if normalize:
          return df.div(df.sum(axis="columns"), axis="rows")
      return df
  
file_path: prince/prince/datasets.py
imports: from __future__ import annotations
  import pathlib
  import pandas
label_desc: Use image node_id 1 for calling a global function with example usage: load_energy_mix(year, normalize) and returns: df, df