# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['pydeflate', 'pydeflate.deflate', 'pydeflate.get_data', 'pydeflate.tools']

package_data = \
{'': ['*'], 'pydeflate': ['.pydeflate_data/*', 'settings/*']}

install_requires = \
['bblocks>=1.0.2,<2.0.0',
 'beautifulsoup4>=4.11.2,<5.0.0',
 'country-converter>=0.8.0,<0.9.0',
 'numpy>=1.24.1,<2.0.0',
 'pandas>=1.5.3,<2.0.0',
 'pyarrow>=11.0.0,<12.0.0',
 'requests>=2.28.2,<3.0.0',
 'weo>=0.7.4,<0.8.0',
 'xlrd>=2.0.1,<3.0.0']

setup_kwargs = {
    'name': 'pydeflate',
    'version': '1.3.3',
    'description': 'Package to convert current prices figures to constant prices and vice versa',
    'long_description': '# pydeflate\n\n[![pypi](https://img.shields.io/pypi/v/pydeflate.svg)](https://pypi.python.org/pypi/pydeflate)\n[![Documentation Status](https://readthedocs.org/projects/pydeflate/badge/?version=latest)](https://pydeflate.readthedocs.io/en/latest/?version=latest)\n[![black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Downloads](https://pepy.tech/badge/pydeflate/month)](https://pepy.tech/project/pydeflate)\n[![Coverage](https://codecov.io/gh/jm-rivera/pydeflate/branch/main/graph/badge.svg?token=uwKI5DyO3w)](https://codecov.io/gh/jm-rivera/pydeflate)\n\n**pydeflate** is a Python package to convert flows data to constant\nprices. This can be done from any source currency to any desired base\nyear and currency. **Pydeflate** can also be used to convert constant\ndata to current prices and to convert from one currency to another (in\ncurrent and constant prices). Users can choose the source of the\nexchange and deflator/prices data (currently, IMF, World Bank or OECD\nDAC).\n\n## Getting started\n\n### Installation\n\npydeflate can be installed from PyPI. From the command line:\n\n```bash\n\npip install pydeflate\n\n```\n\n## Basic usage\n\n### Current to constant\n\nConvert data expressed in current USD prices to constant EUR prices for\na given base year:\n\n```python\nfrom pydeflate import deflate, set_pydeflate_path\nimport pandas as pd\n\n# Specify where the deflator and exchange data should be saved\nset_pydeflate_path("path/to/data/folder")\n\n# example data\ndata = {\n    \'iso_code\': [\'FRA\', \'USA\', \'GTM\'],\n    \'year\': [2017, 2017, 2017],\n    \'value\': [50, 100, 200]\n}\n\n# create an example dataframe, in current USD prices\ndf = pd.DataFrame.from_dict(data)\n\n# convert to EUR 2015 constant prices\ndf_constant = deflate(\n    df=df,\n    base_year=2015,\n    deflator_source=\'world_bank\',\n    deflator_method=\'gdp\',\n    exchange_source="world_bank",\n    source_currency="USA",  # since data is in USD\n    target_currency="EMU",  # we want the result in constant EUR\n    id_column="iso_code",\n    id_type="ISO3",  # specifying this is optional in most cases\n    date_column="year",\n    source_column="value", # where the original data is\n    target_col="value_constant", # where the new data will be stored\n)\n```\n\nThis results in a dataframe containing a new column `value_constant` in\n2015 constant prices. In the background, pydeflate takes into account:\n\n- changes in princes, through a gdp deflator in this case\n- changes in exchange rates overtime\n\n### Current Local Currency Units to constant in a different currency\nPydeflate can also handle data that is expressed in local currency\nunits. In that case, users can specify `LCU` as the source currency.\n\n```python\nfrom pydeflate import deflate, set_pydeflate_path\nimport pandas as pd\n\n# Specify where the deflator and exchange data should be saved\nset_pydeflate_path("path/to/data/folder")\n\n# example data\ndata = {\n    \'country\': [\'United Kingdom\', \'United Kingdom\', \'Japan\'],\n    \'date\': [2011, 2015, 2015],\n    \'value\': [100, 100, 100]\n}\n\n# create an example dataframe, in current local currency units\ndf = pd.DataFrame.from_dict(data)\n\n# convert to USD 2018 constant prices\ndf_constant = deflate(\n    df=df,\n    base_year=2018,\n    deflator_source=\'imf\',\n    deflator_method=\'pcpi\',\n    exchange_source="imf",\n    source_currency="LCU",  # since data is in LCU\n    target_currency="USA",  # to get data in USD\n    id_column="iso_code",\n    date_column="date",\n    source_col="value",\n    target_col="value",  # to not create a new column\n)\n\n```\n\n### Constant to current\nUsers can also convert a dataset expressed in constant prices to current\nprices using pydeflate. To avoid introducing errors, users should know\nwhich methodology/ data was used to create constant prices by the\noriginal source. The basic usage is the same as before, but the\n`to_current` parameter is set to `True`.\n\nFor example, to convert DAC data expressed in 2016 USD constant prices\nto current US dollars:\n\n```python\nfrom pydeflate import deflate, set_pydeflate_path\nimport pandas as pd\n\n# Specify where the deflator and exchange data should be saved\nset_pydeflate_path("path/to/data/folder")\n\n# example data\ndata = {\n    \'dac_code\': [302, 4, 4],\n    \'date\': [2010, 2016, 2018],\n    \'value\': [100, 100, 100]\n}\n\n# create an example dataframe, in current local currency units\ndf = pd.DataFrame.from_dict(data)\n\n# convert to USD 2018 constant prices\ndf_current = deflate(\n    df=df,\n    base_year=2016,\n    deflator_source=\'oecd_dac\',\n    deflator_method=\'dac_deflator\',\n    exchange_source="oecd_dac",\n    source_currency="USA",  # since data is in USD constant\n    target_currency="LCU",  # to get the current LCU figures\n    id_column="dac_code",\n    id_type="DAC",\n    date_column="date",\n    source_column="value",\n    target_column="value_current",\n    to_current=True,\n)\n```\n\n## Data source and method options\n\nIn order to convert the data, pydeflate uses data on **price/gdp deflators** and\n**exchange rates**. Each of these data sources can come from the `OECD DAC`,\n`IMF (WEO)` or `World Bank`.\n\nFor all sources, Exchange rates between two non USD currency pairs are derived from\nthe LCU to USD exchange rates selected.\n\n### International Monetary Fund World Economic Outlook ("imf")\n\nFor price/gdp deflators from the IMF, the following options are available (`deflator_method`):\n- `gdp`: in order to use GDP deflators.\n- `pcpi`: in order to use Consumer Price Index data.\n- `pcpie`: to use end-of-period Consumer Price Index data\n  (e.g. for December each year).\n\nThe IMF provides estimates where data is not available, including for several\nyears into the future. Using these price deflators, combined with the corresponding\nexchange rates, allows users to convert data to constant prices for future years.\n\nFor exchange rates, the following options are available from the imf (`exchange_method`):\n- `implied`: to use the exchange rates used by the World Economic Outlook, derived from\n    the WEOs data on GDP in US Dollars and Local Currency Units.\n\n### World Bank ("world_bank")\n\nFor price/gdp deflators from the World Bank, the following options are available (`deflator_method`):\n\n\nIn terms of price or GDP deflators, pydeflate provides the following\n- `gdp`: in order to use GDP deflators.\n- `gdp_linked`: to use the World Bank\'s GDP deflator series which\n  has been linked to produce a consistent time series to\n  counteract breaks in series over time due to changes in base\n  years, sources or methodologies.\n- `cpi`: to use Consumer Price Index data\n\nFor exchange rates, the following options are available from the World Bank (`exchange_method`):\n- `yearly_average`: as used by the World Bank, based on IMF International Financial Statistics data.\n\n\n### OECD Development Assistance Committee ("oecd_dac")\n\nFor price/gdp deflators from the OECD DAC, the following options are available (`deflator_method`):\n\nIn terms of price or GDP deflators, pydeflate provides the following:\n- `dac_deflator`: in order to use the DAC\'s own deflator series.\n\nFor exchange rates, the following options are available from the OECD DAC (`exchange_method`):\n- `implied`: to use the exchange rates used and published by the DAC.\n\n\n\n## Additional features\n\nPydeflate relies on data from the World Bank, IMF and OECD for its\ncalculations. This data is updated periodically. If the version of the\ndata stored in the user\'s computer is older than 50 days, pydeflate will\nshow a warning on import.\n\nUsers can always update the underlying data by using:\n\n```python\nimport pydeflate\n\npydeflate.update_all_data()\n\n```\n\nPydeflate also provides users with a tool to exchange figures from one\ncurrency to another, without applying any deflators. This should only be\nused on numbers expressed in current prices, however.\n\nFor example, to convert numbers in current Local Currency Units (LCU) to\ncurrent Canadian Dollars:\n\n```python\nimport pydeflate\nimport pandas as pd\n\n# example data\ndata = {\n    \'iso_code\': [\'GBR\', \'CAN\', \'JPN\'],\n    \'date\': [2011, 2015, 2015],\n    \'value\': [100, 100, 100]\n}\n\n# create an example dataframe, in current local currency units\ndf = pd.DataFrame.from_dict(data)\n\n# convert to USD 2018 constant prices\ndf_can = pydeflate.exchange(\n    df=df,\n    source_currency="LCU",  # since data is in LCU\n    target_currency="CAN",  # to get data in Canadian Dollars\n    rates_source=\'imf\', \n    value_column=\'value\',\n    target_column=\'value_CAN\',\n    id_column="iso_code",\n    id_type="ISO3",\n    date_column="date",\n)\n\n```\n\n### Credits\n\nThis package relies on data from the following sources:\n\n- OECD DAC: <https://www.oecd.org/dac/> (Official Development\n  assistance data (DAC1), DAC deflators, and exchange rates used by\n  the DAC)\n- IMF World Economic Outlook:\n  <https://www.imf.org/en/Publications/WEO> (GDP and price deflators)\n- World Bank DataBank: <https://databank.worldbank.org/home.aspx>\n  (exchange rates, GDP and price deflators)\n\nThis data is provided based on the terms and conditions set by the\noriginal sources.',
    'author': 'Jorge Rivera',
    'author_email': 'jorge.rivera@one.org',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'None',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.10,<4.0',
}


setup(**setup_kwargs)
