Check the setup
- Python 3.10 or newer
- A notebook environment such as Jupyter or Google Colab
- A free EIA API key saved in the EIA_API_KEY environment variable
Hourly U.S. electricity demand, forecasts, generation, and interchange for building grid monitors, demand alerts, and energy forecasting tools.
From source to product signal
EIA's Hourly Electric Grid Monitor publishes demand, day-ahead forecasts, net generation, and interchange by balancing authority. Start with one authority and a bounded response. Values can be revised, and demand, generation, forecasts, and interchange have different meanings that must not be combined without checking their type and units.
Install the packages, then run the notebook cell.
python -m pip install pandas requests
import os
import pandas as pd
import requests
response = requests.get(
"https://api.eia.gov/v2/electricity/rto/region-data/data/",
params={
"api_key": os.environ["EIA_API_KEY"],
"frequency": "hourly",
"data[0]": "value",
"facets[respondent][]": "CAL",
"length": 500,
},
timeout=30,
)
response.raise_for_status()
grid = pd.DataFrame(response.json()["response"]["data"])
grid["period"] = pd.to_datetime(grid["period"])
grid["value"] = pd.to_numeric(grid["value"], errors="coerce")
print(grid[["period", "respondent-name", "type-name", "value", "value-units"]].head())Test a useful signal
Test whether forecast errors for one balancing authority can trigger a useful grid-demand alert.
U.S. Energy Information Administration is a government source. Last verified 2026-08-11. Temporal coverage: 2015-present.