Python Wrapper for The Observatory for Economic Complexity API
Language: Python 3
Data Source: Observatory for Economic Complexity (OEC)
Status
As of June 2021, the OEC has migrated to a new website at oec.world, and this new site no longer hosts a free API. There is a legacy version of the site hosted at legacy.oec.world, and this library has been updated to refer to that legacy version.
Installation
pip install oec
Usage
Get data from OEC
import oec
# Set parameters in accordance with API documentation
params = {'classification': 'hs92',
'trade_flow': 'export',
'year': 2015,
'origin': 'egy',
'destination': 'all',
'product': 'show'}
list_of_countries = oec.get_countries()
list_of_products = oec.get_products(params['classification'])
list_of_exports = oec.get_trade(**params)
These functions each return lists of dictionaries. Each of these dictionaries represents a "row" of data (e.g. one country or product). The fields of these dictionaries represent "columns" of data. This is easier to visualize if you output your data to a CSV file.
Export to CSV
oec.data_to_csv(list_of_dictionaries, 'results.csv')
These CSV files can then be opened up in the spreadsheet editor of your choice for further analysis.
Generate links to visualizations
>>> oec.url_visual(**params)
'https://legacy.oec.world/en/visualize/tree_map/hs92/export/egy/all/show/2015/'
>>> oec.embed_visual(**params)
'<iframe src="https://legacy.oec.world/en/visualize/embed/tree_map/hs92/export/egy/all/show/2015/" width=930 height=400></iframe>'
>>> oec.url_visual(**params, language='fr')
'https://legacy.oec.world/fr/visualize/tree_map/hs92/export/egy/all/show/2015/'
Documentation
Function-level documentation and language list: see help.txt or run python -m pydoc oec
OEC API documentation
Data attributes and field names
Acknowledgements
Credits to Alex Simoes for the development of The Observatory for Economic Complexity. This module was developed by Yahia Ali, who is not affiliated in any way with the OEC team.
Metadata
Release files for oec 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oec-0.3.0.tar.gz | 4.3 kB | Without provenance | Details for oec-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oec-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for oec-0.3.0-py3-none-any.whl |
Total release size: 9.5 kB
Release files / oec-0.3.0.tar.gz
| Download URL | oec-0.3.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b050dcc6834b702203cecdf87467a2ed59ec50e34c97b9b10b311d6f57c124be
|
|
BLAKE2b-256 checksum How to use checksums |
feedbc16b084814b6701d8afd09d0253de76b0a1900cb74001876a62ea3991cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Release files / oec-0.3.0-py3-none-any.whl
| Download URL | oec-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38bdc5a8f9e295f0831d3425a59119d69a13002c01eb48c828ffb2c7c4bfdae1
|
|
BLAKE2b-256 checksum How to use checksums |
11025e7a1e540139f46564a4748c52e0c88947a1962e5ea9a2927f4caef403b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.5.0 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
|
Security for oec 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.