bblocks.import_tools.fao

Attributes

URL

Functions

__scrape_index_df(→ pandas.DataFrame)

Parse FAO food price index page to retrieve _data csv url

__clean_fao_food_price_index(→ pandas.DataFrame)

Clean index dataframe

get_fao_index(→ pandas.DataFrame)

Get FAO food price index

Module Contents

bblocks.import_tools.fao.URL = 'https://www.fao.org/worldfoodsituation/foodpricesindex/en/'
bblocks.import_tools.fao.__scrape_index_df(url: str) pandas.DataFrame

Parse FAO food price index page to retrieve _data csv url

bblocks.import_tools.fao.__clean_fao_food_price_index(df: pandas.DataFrame) pandas.DataFrame

Clean index dataframe

bblocks.import_tools.fao.get_fao_index(local_path: str | pathlib.Path = BBPaths.imported_data / 'fao_index.csv', update: bool = False) pandas.DataFrame

Get FAO food price index

Parameters:
  • local_path – where the downloaded CSV will be stored

  • update – if True, updates the _data from the FAO website. Otherwise it loads the _data from the local file. If a local file does not exist, the _data will be extracted from the website.