OpenBB-finance/OpenBB · error · RuntimeError
No data found to plot.
Error message
No data found to plot.
What it means
After converting the input to a DataFrame, the BLS charting view requires at least 2 rows to draw a line/bar chart; an empty frame or a single observation raises RuntimeError('No data found to plot.'). This is a data-sufficiency guard, not a conversion failure — the data parsed fine but is too sparse to visualize.
Source
Thrown at openbb_platform/extensions/economy/openbb_economy/economy_views.py:379
)
_data = (
kwargs.pop("data", None)
if "data" in kwargs and kwargs["data"] is not None
else kwargs.get("obbject_item")
)
df = DataFrame()
if isinstance(_data, DataFrame) and not _data.empty:
df = _data.reset_index() if _data.index.name == "date" else _data
else:
try:
df = basemodel_to_df(_data, index=None) # type: ignore
except Exception as e:
raise RuntimeError("Unable to process supplied data.") from e
if df.empty or len(df) < 2:
raise RuntimeError("No data found to plot.")
cols = df.columns.to_list()
target_col = kwargs.get("target_col", "value")
if target_col not in cols:
raise RuntimeError(f"Column '{target_col}' not found in the data.")
new_df = df.pivot(columns="symbol", values=target_col, index="date")
target_symbols = kwargs.get("target_symbol", "").split(",")[:10] # type: ignore
if not target_symbols or len(target_symbols) == 0 or target_symbols[0] == "":
target_symbols = new_df.columns.to_list()[:10]
metadata = kwargs["extra"].get("results_metadata", {}) # type: ignore
ytitle = kwargs.get("ytitle", "")
new_df = new_df.filter(target_symbols, axis=1)
if "percent" in target_col.lower(): # type: ignoreView on GitHub (pinned to 3e071fcc2c)
Solutions
- Check the row count before charting: len(res.to_df()) >= 2.
- Widen the date range (start_date earlier) or drop restrictive filters so at least 2 periods exist.
- Verify the series id actually has data for the requested window (res.to_df().head()).
Example fix
# before fig = obb.economy.bls.multiple_series(symbols=['LNS14000000'], start_date='2026-08-01', provider='bls').charting.bls() # 0-1 rows # after fig = obb.economy.bls.multiple_series(symbols=['LNS14000000'], start_date='2024-01-01', provider='bls').charting.bls()
Defensive patterns
Strategy: validation
Validate before calling
df = res.to_df() if hasattr(res, 'to_df') else data assert df is not None and len(df) >= 2, 'need >= 2 rows to plot'
Type guard
def plottable_row_count(df, minimum: int = 2) -> bool:
"""True when the frame has enough rows for a line/bar chart."""
return df is not None and len(df) >= minimum Try / catch
try:
fig = views.bls_chart(**kwargs)
except RuntimeError as e:
if str(e) == 'No data found to plot.':
# widen the request window and retry once
... Prevention
- Assert len(results) >= 2 before charting.
- Widen start_date for low-frequency series.
- Verify series ids return data for the requested window.
When it happens
Trigger: Charting a BLS series request that returned 0 or 1 records; a date range/filter so narrow only one period survives; passing data= with a one-row DataFrame.
Common situations: Requesting very recent start dates for series published monthly/quarterly with a lag, provider outages returning single rows, or slicing a DataFrame to the latest observation before charting.
Related errors
- Error: No data to plot.
- This charting method does not support {provider}. Supported
- Unable to process supplied data.
- Column '{target_col}' not found in the data.
- Data is empty
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/e352b453f68138fd.
Report an issue: GitHub.