Skip to main content

No project description provided

Project description

myeia

myeia is a simple Python wrapper for the U.S. Energy Information Administration (EIA) APIv2. It is designed to be simple to use and to provide a consistent interface for accessing EIA data.

Installation

pip install myeia

Requirements

  • pandas
  • requests
  • python-dotenv

eia OPEN DATA Registration

To obtain an API Key you need to register on the EIA website.

eia API Query Browser

To find all EIA Datasets visit API Dashboard.

How to use

from myeia.api import API

eia = API()

By Default the EIA class will look for your API EIA_TOKEN.

If you have registered for an API key you can set it in your .env file.

EIA_TOKEN=YOUR_TOKEN_HERE

Lets look at an example of how to get the EIA Natural Gas Futures.

df = eia.get_data(
    route="natural-gas/pri/fut",
    series="RNGC1",
    frequency="daily",
)

df.head()

Output Example:

            Natural Gas Futures Contract 1 (Dollars per Million Btu)
Date
2022-09-13                                              8.284
2022-09-12                                              8.249
2022-09-09                                              7.996
2022-09-08                                              7.915
2022-09-07                                              7.842
...

Lets look at another example the Total OPEC Petroleum Supply where the facet is available as seriesId. By Default it is set as series but we can define the facet as seriesId.

df = eia.get_data(
    route="steo",
    series="PAPR_OPEC",
    frequency="monthly",
    facet="seriesId",
)

df.head()

Output Example:

            Total OPEC Petroleum Supply
Date
2023-12-01                    34.517314
2023-11-01                    34.440397
2023-10-01                    34.376971
2023-09-01                    34.416242
2023-08-01                    34.451823

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

myeia-0.2.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

myeia-0.2.2-py2.py3-none-any.whl (4.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file myeia-0.2.2.tar.gz.

File metadata

  • Download URL: myeia-0.2.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for myeia-0.2.2.tar.gz
Algorithm Hash digest
SHA256 9f61d894452f59d9e88701139a16b2d563d36995a589f4763def347d63c7559e
MD5 74d0100aa518c0c438615045e76cad87
BLAKE2b-256 13e7df2de17c6d21538ee4ad439d8a2157ea4d95ad4a794daf8e43e8ce02aa7f

See more details on using hashes here.

File details

Details for the file myeia-0.2.2-py2.py3-none-any.whl.

File metadata

  • Download URL: myeia-0.2.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for myeia-0.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c250a32cb6077d5615fa6705238580ed303f00dc4c4fd0cff5a5599f636045d0
MD5 2eb0547aabea6fa04a879bf54dd5deb4
BLAKE2b-256 a45298d19379703281441227adbb45cc0bf63e35f8ac32fbb5793922fc739b09

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page