{ "info": { "author": "James Otterson", "author_email": "jjotterson@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "\n\n[![image](https://img.shields.io/pypi/v/datapungi_fed.svg)](https://pypi.org/project/datapungi_fed/) \n[![build Status](https://travis-ci.com/jjotterson/datapungi_fed.svg?branch=master)](https://travis-ci.com/jjotterson/datapungi_fed)\n[![downloads](https://img.shields.io/pypi/dm/datapungi_fed.svg)](https://pypi.org/project/datapungi_fed/)\n[![image](https://img.shields.io/pypi/pyversions/datapungi_fed.svg)](https://pypi.org/project/datapungi_fed/)\n\ninstall code: pip install datapungi_fed \n\n

datapungi_fed

\n\n datapungi_fed is a python package that extracts FRED and GeoFRED data from Federal Reserve (FED) by connecting to its API. Overall it:\n - provides a quick access to a FED's time series data \n - provides both a cleaned up output (pandas) and a full request output of any FRED or GeoFRED dataset.\n - provides code snippets that can be used to access the FED API independently of datapungi_fed \n - can read a saved API key (as an environment variables (default) or from json/yaml files) to avoid having a copy of it on a script\n - can run many tests such as if all database access are working, the data is being cleaned correlty and if the code snippet returns the correct data. \n\n\n## Sections\n - [Short sample runs](#Sample-runs)\n - [Short sample runs of all drivers](#Sample-run-of-all-drivers)\n - [Description of a full return](#Full-request-result) \n - [Setting up datapungi_fed](#Setting-up-datapungi_fed)\n - [Testing the package](#Running-Tests) \n\n## Sample runs\n\n### Short runs:\n\ndatapungi_fed is designed to quickly access FED time series data. After [Setting up datapungi_fed](#Setting-up-datapungi_fed), a time series symbol (say 'gdp') can be fetched by typing:\n\n```python\nimport datapungi_fed as dpf\n\ndpf('gdp') \n```\n\nIf in doubt, try the print command on an datapungi_fed object to get information on how to proceed.\n\n```python\n'''Getting Help'''\n\nimport datapungi_fed as dpf\n\nprint(dpf) #suggests to run data = dpf.data()\n\ndata = dpf.data()\nprint(data) #list the database groups (eg. geo) and short description of each\n\nprint(data.geo) #list the databases in the groups, their short descriptions and parameters\nprint(data.categories) \nprint(data.series) \n```\n\n\n\nAt a top level, FRED has 5 groups of databases and we group the GeoFRED under the same group (\"geo\"). datapungi_fed includes a 6th group (datasetlist). \n\n\nFRED database group | description\n----------- | -----------\ndataselist | datapungi_fed metadata of all other (FRED and GeoFRED) databases\n[categories](https://fred.stlouisfed.org/categories/) | Catagories of datasets - 8 top categories (eg, National Accounts, Prices) that break down into subgroups \n[releases ](https://fred.stlouisfed.org/releases/) | Release groups of data - about 300 (eg, Western Hemisphere Regional Economic Outlook, Penn World Table)\n[series ](https://fred.stlouisfed.org/) | About 600,000 time series provided by various sources\n[sources ](https://fred.stlouisfed.org/sources/) | List of data sources - about 90 data providers (eg, IMF and Bank of Mexico)\n[tags ](https://fred.stlouisfed.org/tags/) | Tags applied to time series (eg, location, data source, frequency) - about 5,000 tags\n[geo ](https://research.stlouisfed.org/docs/api/geofred/) | Harvest data and shape files found in GeoFRED \n\n\nThese groups of databases are broken down into sets of databases. datapungi_fed access all of them, but \nfor each group it defaults to a specific case (use the \"print\" command as described above to get the name of the default database). Below is a run sample of each default search.\n\n```python\n'''Sample Query of All Database Groups - Default Databases'''\n\nimport datapungi_fed as dpf\n\ndata = dpf.data() \n\ndata.datasetlist() \ndata.categories(125) \ndata.releases()\ndata.series('GDP')\ndata.sources('1') \ndata.tags(tag_names='monetary+aggregates;weekly')\ndata.geo(series_id='WIPCPI')\n```\nNOTICE: all returned pandas dataframes contain a \"_meta\" attribute with metadata information of dataset.\n\n```python\n'''Returned Metadata'''\n\nimport datapungi_fed as dpf\n\ndpf('gnp')._meta\n```\nNOTICE: \"meta\" is not a pandas official attribute; slight changes to the dataframe (say, merging, or multiplying it by a number) will remove meta.\n\n### Verbose \n\nUse the verbose option to get the full request result, a cleaned version of the dataset, and a string of the code used to get the data.\n\n```python\n'''Verbose Run: Get Full Request Result, Cleaned Data, and Code Snippet'''\n\nimport datapungi_fed as dpf\n\ndata = dpf.data()\nfull = data.series('gnp',verbose=true) \nfull['dataFrame'] #pandas table, as above\nfull['request'] #full request run, see section below\nfull['code'] #code snippet of a request that reproduces the query. \n\n#to get the request result:\nfull['request'].json()\n```\n \nNotice: By default, datapungi_fed requests data in json format. \n\n### Sample run of all drivers\n\n\n\n\n```python\n'''Sample Run of All Datasets'''\nimport datapungi_fed as dpf\n\n\ndata = dpf.data()\n\n# Categories data group\nprint(data.categories)\ndata.categories(125)\ndata.categories['category'](125)\ndata.categories['children'](13)\ndata.categories['related'](32073)\ndata.categories['series'](125)\ndata.categories['tags'](125)\ndata.categories['related_tags'](125,tag_names=\"services;quarterly\")\n \n# Releases data group\nprint(data.releases)\ndata.releases(verbose=True)\ndata.releases['releases'](verbose=True)\ndata.releases['release/dates'](release_id=53,verbose=True)\ndata.releases['release'](release_id=53,verbose=True)\ndata.releases['release/dates'](release_id=53,verbose=True)\ndata.releases['release/series'](release_id=53,verbose=True)\ndata.releases['release/sources'](release_id=53,verbose=True)\ndata.releases['release/tags'](release_id=53,verbose=True)\ndata.releases['release/related_tags'](release_id='86',tag_names='sa;foreign',verbose=True)\ndata.releases['release/tables'](release_id=53,verbose=True)\n \n# Series data group\nprint(data.series)\ndata.series('gdp',verbose=True) \ndata.series['series']('GDP',verbose=True)\ndata.series['categories']('EXJPUS',verbose=True)\ndata.series['observations']('GNP',verbose=True)\ndata.series['release']('IRA',verbose=True)\ndata.series['search'](search_text='monetary+service+index',verbose=True)\ndata.series['search/tags'](series_search_text='monetary+service+index',verbose=True)\ndata.series['search/related_tags'](series_search_text='mortgage+rate',tag_names='30-year;frb',verbose=True)\ndata.series['tags'](series_id='STLFSI',verbose=True)\ndata.series['categories']('EXJPUS',verbose=True)\ndata.series['updates'](verbose=True)\ndata.series['vintagedates']('GNPCA',verbose=True)\n \n# Tags data group\nprint(data.tags)\ndata.tags(tag_names='monetary+aggregates;weekly',verbose=True)\ndata.tags['tags'](tag_names='monetary+aggregates;weekly',verbose=True)\ndata.tags['related_tags'](tag_names='monetary+aggregates;weekly',verbose=True)\ndata.tags['tags/series'](tag_names='slovenia;food;oecd',verbose=True)\n\n#Geo data group\nprint(data.geo)\ndata.geo['shapes']('bea')\ndata.geo['meta'](series_id='SMU56000000500000001')\ndata.geo(series_id='WIPCPI',start_date='2012-01-01')\ndata.geo['data'](series_group='882',date='2013-01-01',region_type='state',units='Dollars',frequency='a',season='NSA')\n```\n\n\n\n\n\n## Setting up datapungi_fed \n\nTo use the FED API, **the first step** is to [get an API key from the FED](https://research.stlouisfed.org/docs/api/api_key.html).\n\n### Quick Setup (Suggest Setup)\n\nFor a quick setup, just save your api key as an environment variable called API_KEY_FED by, for example, typing on a termninal:\n\n- windows:\n ```\n > setx API_KEY_FED \"your api key\"\n ```\n- mac:\n ```\n $ touch ~/.bash_profile\n $ open -a TextEdit.app ~/.bash_profile\n ```\n add the following text at the end and save it: \n \n ```\n export API_KEY_FED=yourKey \n ```\n\nClose the terminal (may need to restart the computer) after saving the variable. \n\n\nNotice: searching for an environment variable named 'API_KEY_FED' is the default option. If changed to some other option and want to return to the default, run:\n\n```python\nimport datapungi_fed as dpf\n\ndpf.utils.setUserSettings('env') \n```\n\nIf you want to save the url of the API in the environment, call it API_KEY_FED_url. datapungi_fed will use the provided http address instead of the default. \n\n### Other setting up options:\n\nBesides the suggested setup above, there are two main options to pass an api key to datapungi_fed:\n\n#### (Option 1) Pass the key directly:\n```python\nimport datapungi_fed as dpf\n\ndata = dpf.data(\"API KEY\")\n\ndata.series('gdp')\n```\n\n#### (Option 2) Save the key in either a json or yaml file and let datapungi_fed know its location:\n\n sample json file : \n```python\n { \n \"API_KEY_FED\": {\"key\": \"**PLACE YOUR KEY HERE**\", \"url\": \"\"},\n (...Other API keys...)\n }\n```\nsample yaml file:\n\n```yaml\nAPI_KEY_FED: \n key: PLACE API KEY HERE\n description: FED data\n url: \napi2:\n key:\n description:\n url:\n```\n\nSave the path to your FED API key on the package's user settings (only need to run the utils once, datapungi_fed will remember it in future runs):\n\n\n```python\nimport datapungi_fed as dpf\n\ndpf.utils.setUserSettings('C:/Path/myKeys.yaml') #or .json\n\ndata = dpf.data()\ndata.series('gdp')\n```\n \n\n### Changing the API key name\n By default, datapungi_fed searches for an API key called 'FED' (in either json/yaml file or in the environment). In some cases, it's preferable to call it something else (in conda, use FED_Secret to encript it). To change the name of the key, run\n\n ```python\n import datapungi_fed as dpf\n \n dpf.utils.setKeyName('FED_Secret') #or anyother prefered key name\n ```\n When using environment variables, if saving the API url in the environment as well, call it KeyLabel_url (for example, 'FED_Secret_url'). Else, datapungi_fed will use the default one.\n \n## Running Tests\n\ndatapungi_fed comes with a family of tests to check its access to the API and the quality of the retrieved data. They check if:\n\n1. the connection to the API is working,\n2. the data cleaning step worked,\n3. the code snippet is executing,\n4. the code snippet produces the same data as the datapungi_fed query.\n\nOther tests check if the data has being updated of if new data is available. Most of these tests are run every night on python 3.5, 3.6 and 3.7 (see the code build tag on the top of the document). However, \nthese test runs are not currently checking the code snippet quality to check if its output is the same as the driver's. To run the tests, including the one \nthat checks code snippet quality, type:\n\n```python\nimport datapungi_fed as dpf\n\ndpf.tests.runTests(outputPath = 'C:/Your Path/')\n```\n\nThis will save an html file in the path specified called datapungi_fed_Tests.html\n\nYou can save your test output folder in the user settings as well (need / at the end):\n\n```python\nimport datapungi_fed as dpf\n\ndpf.utils.setTestFolder('C:/mytestFolder/')\n```\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jjotterson/datapungi_fed", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "datapungi_fed", "package_url": "https://pypi.org/project/datapungi_fed/", "platform": "", "project_url": "https://pypi.org/project/datapungi_fed/", "project_urls": { "Homepage": "https://github.com/jjotterson/datapungi_fed" }, "release_url": "https://pypi.org/project/datapungi_fed/0.2.0/", "requires_dist": [ "requests", "pandas", "pytest", "pytest-html", "pyperclip", "lxml", "xlrd", "beautifulsoup4", "html5lib", "pyyaml" ], "requires_python": "", "summary": "Gets FRED and GeoFRED data from Federal Reserve (FED) by connecting to its API.", "version": "0.2.0" }, "last_serial": 5902975, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "052ce7644bf76440377c58167216c49f", "sha256": "c3633e089a45283b3fdac8121338660cfa4313bb522cc0980a519bf6224cb8c6" }, "downloads": -1, "filename": "datapungi_fed-0.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "052ce7644bf76440377c58167216c49f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 62743, "upload_time": "2019-09-17T05:54:28", "url": "https://files.pythonhosted.org/packages/b1/d6/25c99c2b5ab55cb818a2e2be0108f1723ec8fb55414b49ffa3ccc5272e23/datapungi_fed-0.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0033082e8c2847ebfa10e01fd843d432", "sha256": "409896d3a7fa47f9f5f7eb97a50120461b960b49a385cd6ddd981b80dd1cdaa0" }, "downloads": -1, "filename": "datapungi_fed-0.1.0.tar.gz", "has_sig": false, "md5_digest": "0033082e8c2847ebfa10e01fd843d432", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18607, "upload_time": "2019-09-17T05:55:29", "url": "https://files.pythonhosted.org/packages/fa/46/20b8a6b897c5cb8c54e57e67f7e3a1e00eddfa65b117cd61f7d64f266126/datapungi_fed-0.1.0.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "f6ac5ef0e4a78cc50c44c0d7267a1e56", "sha256": "b3da230dd07d0288380aef57f2f4c08fd34907be8ba5e2e1ac85d7eec2ff584a" }, "downloads": -1, "filename": "datapungi_fed-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f6ac5ef0e4a78cc50c44c0d7267a1e56", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 64055, "upload_time": "2019-09-20T03:44:35", "url": "https://files.pythonhosted.org/packages/83/ec/74c5069fe1ae5b38d94dbb41469f5d10d58d67ddd767cb6efd94205beb0d/datapungi_fed-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d4579c0b7970c0fbdaf0d6752703b670", "sha256": "26faf7aec3ab40874e1a3c5699fbce644d3c35b5f0980139a2e3e030c57ffd32" }, "downloads": -1, "filename": "datapungi_fed-0.1.2.tar.gz", "has_sig": false, "md5_digest": "d4579c0b7970c0fbdaf0d6752703b670", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19394, "upload_time": "2019-09-20T03:45:29", "url": "https://files.pythonhosted.org/packages/10/4e/fb3cce72be7fe473dcd65af6bd4c9295d301ac68c5e532094fc9e637dfc6/datapungi_fed-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "8c02836e1abea45a00b7fbda97061afd", "sha256": "4895ad4e50a1c77d5abe0396039e7f6597715a6fec7aa18a1a5821f4d57b79c3" }, "downloads": -1, "filename": "datapungi_fed-0.1.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8c02836e1abea45a00b7fbda97061afd", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 75841, "upload_time": "2019-09-28T03:51:15", "url": "https://files.pythonhosted.org/packages/e8/2e/892f976fcd029b8b9a81250cd6ac9de1315310af2553f75e05225116abf7/datapungi_fed-0.1.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5151ebedafea1a4f7c04c2eeaf238ba6", "sha256": "204fd672a448869f7c3dd2aa368f65b568294a60dc3c23fb64232570c607afc8" }, "downloads": -1, "filename": "datapungi_fed-0.1.3.tar.gz", "has_sig": false, "md5_digest": "5151ebedafea1a4f7c04c2eeaf238ba6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19525, "upload_time": "2019-09-28T03:51:26", "url": "https://files.pythonhosted.org/packages/a8/31/5433e33636908ba5f43014e0c8176dc1c0fff85a07097de6b1d9e81f3c0b/datapungi_fed-0.1.3.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "d40cf715722387c12bb2eba9b888d7b1", "sha256": "4e9dd64da10d286416a8481348ea774cdbcce753118dbc691b4151c55174d039" }, "downloads": -1, "filename": "datapungi_fed-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d40cf715722387c12bb2eba9b888d7b1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 99711, "upload_time": "2019-09-29T16:15:01", "url": "https://files.pythonhosted.org/packages/c9/00/6fccfd27ec3ecbab0e16ab06240d58d96589b093b063c27093fe61e24815/datapungi_fed-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "652a06f646cd7d4db5af71ba20a3caae", "sha256": "f46a08549380efe72c8e9ca1128c7684bef1558d5343ec09bad006a26f12f394" }, "downloads": -1, "filename": "datapungi_fed-0.2.0.tar.gz", "has_sig": false, "md5_digest": "652a06f646cd7d4db5af71ba20a3caae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20848, "upload_time": "2019-09-29T16:15:08", "url": "https://files.pythonhosted.org/packages/66/4a/81432b4957425661c6122d0fc2ff3bd1f47d2778b48dca59adecac4976d3/datapungi_fed-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d40cf715722387c12bb2eba9b888d7b1", "sha256": "4e9dd64da10d286416a8481348ea774cdbcce753118dbc691b4151c55174d039" }, "downloads": -1, "filename": "datapungi_fed-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d40cf715722387c12bb2eba9b888d7b1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 99711, "upload_time": "2019-09-29T16:15:01", "url": "https://files.pythonhosted.org/packages/c9/00/6fccfd27ec3ecbab0e16ab06240d58d96589b093b063c27093fe61e24815/datapungi_fed-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "652a06f646cd7d4db5af71ba20a3caae", "sha256": "f46a08549380efe72c8e9ca1128c7684bef1558d5343ec09bad006a26f12f394" }, "downloads": -1, "filename": "datapungi_fed-0.2.0.tar.gz", "has_sig": false, "md5_digest": "652a06f646cd7d4db5af71ba20a3caae", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20848, "upload_time": "2019-09-29T16:15:08", "url": "https://files.pythonhosted.org/packages/66/4a/81432b4957425661c6122d0fc2ff3bd1f47d2778b48dca59adecac4976d3/datapungi_fed-0.2.0.tar.gz" } ] }