Python Wrapper for The Observatory for Economic Complexity API
Language: Python 3
Data Source: Observatory for Economic Complexity (OEC)
Installation
git clone https://github.com/yahiaali/oec.git
pip3 install -r oec/requirements.txt
Usage
See the OEC website for details about acceptable parameters for an API call: https://atlas.media.mit.edu/api/
Get data from the OEC website
import oec
# Set parameters in accordance with API documentation
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(classification)
list_of_exports = oec.get_trade_data(classification, trade_flow, year, origin, destination, product)
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.
Output data to a CSV file
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.
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.1.5
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.1.5.tar.gz | 1.9 kB | Without provenance | Details for oec-0.1.5.tar.gz |
Release files / oec-0.1.5.tar.gz
| Download URL | oec-0.1.5.tar.gz |
|---|---|
| Size | 1.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
def944a17fedd906905238c92fae50f99d18861fe0f0248f606b342f2795638f
|
|
BLAKE2b-256 checksum How to use checksums |
0a61a7bee6492178568bb37f3e68de9d8cd489142c3567bf3f66b940ac52fa5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for oec 0.1.5
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.