---
name: eia-open-data-ingestion
description: "How to get EIA Open Data data into a pandas DataFrame and Parquet: access, the request, the format, limits, quirks and terms."
---

# Load EIA electricity data into pandas and Parquet

Source entry: https://signal-lab-jet.vercel.app/datasets/eia-open-data
Provider: https://www.eia.gov/opendata/
Checked against the provider's documentation: 2026-10-29

## Access
- A free API key is required. Put it in EIA_API_KEY.
- Bulk files do not require a key.

## Request
```bash
curl 'https://api.eia.gov/v2/electricity/retail-sales/data/?api_key='$EIA_API_KEY'&frequency=monthly&data[0]=price&facets[stateid][]=US&start=2025-01&length=5000'
```

## Format
JSON: response data array plus warnings, total, dateFormat and frequency metadata. Values can be strings or numbers by route.

## Load into pandas and Parquet
Needs Python 3 with requests, pandas and pyarrow.
```python
"""EIA monthly US retail electricity price -> pandas -> Parquet. Free API key."""
import os
import requests
import pandas as pd

URL = "https://api.eia.gov/v2/electricity/retail-sales/data/"
params = {"api_key": os.environ["EIA_API_KEY"], "frequency": "monthly", "data[0]": "price",
          "facets[stateid][]": "US", "start": "2025-01", "length": 5000, "offset": 0}
rows = []
while True:
    r = requests.get(URL, params=params, timeout=30)
    r.raise_for_status()
    response = r.json()["response"]
    rows += response["data"]
    params["offset"] += len(response["data"])
    if params["offset"] >= int(response["total"]):
        break
df = pd.DataFrame(rows)
df["period"] = pd.to_datetime(df["period"])
df["price"] = pd.to_numeric(df["price"])
df.to_parquet("eia_us_retail_electricity_price.parquet", index=False)
print(len(df), "rows", df["period"].min().date(), "to", df["period"].max().date())
```
Needs a personal API key; not run.

## Limits
- JSON responses return at most 5,000 rows; page with offset and length.
- Rate limit: Not stated. EIA requires clients to throttle requests per second and per hour.

## Quirks
- Each route has its own facets, frequency values and data columns; inspect route metadata first.
- Keep the unit column with each series.
- A key can be temporarily suspended if request tolerances are exceeded.

## Terms and attribution
- US government EIA publications are in the public domain, but third-party material may be protected.
- EIA asks users to identify EIA as the source and include the publication date.
- Do not imply endorsement and do not use the EIA logo without permission.
- Terms page: https://www.eia.gov/about/copyrights_reuse.php

## Sources
- https://www.eia.gov/opendata/documentation.php: "our API only returns a maximum of 5,000 rows"
- https://www.eia.gov/opendata/terms-of-service.php: "You should use the "EIA" or the "U.S. Energy Information Administration" names in order to identify the source"
- https://www.eia.gov/about/copyrights_reuse.php: "U.S. government publications are in the public domain and are not subject to copyright protection."

## Help improve this skill
Missing a source, or see something to improve? Call the MCP tool suggest_source or feedback (or POST /api/suggest or /api/feedback). Reviewed ideas: https://signal-lab-jet.vercel.app/agent-suggestions

Information for educational purposes only. Free tiers, limits and licenses belong to the providers and may change; check the provider's own terms before using the data.
