OpenBB-finance/OpenBB · error · ValueError
Error: Maturity column not found in the data.
Error message
Error: Maturity column not found in the data.
What it means
The fixed-income rate-curve chart requires a 'maturity' column to sort tenors with its duration sorter and build the curve's x-axis. After the empty-data check, a frame without 'maturity' raises ValueError('Error: Maturity column not found in the data.'), meaning the payload parsed but is not rate-curve-shaped data.
Source
Thrown at openbb_platform/extensions/fixedincome/openbb_fixedincome/fixedincome_views.py:47
from pandas import DataFrame
data = kwargs.get("data")
df: DataFrame = DataFrame()
if data:
if isinstance(data, DataFrame) and not data.empty: # noqa: SIM108
df = data
elif isinstance(data, (list, Data)):
df = basemodel_to_df(data, index=None) # type: ignore
else:
pass
else:
df = DataFrame([d.model_dump() for d in kwargs["obbject_item"]]) # type: ignore
if df.empty:
raise ValueError("Error: No data to plot.")
if "maturity" not in df.columns:
raise ValueError("Error: Maturity column not found in the data.")
if "rate" not in df.columns:
raise ValueError("Error: Rate column not found in the data.")
if "date" not in df.columns:
raise ValueError("Error: Date column not found in the data.")
provider = kwargs.get("provider")
df["date"] = df["date"].astype(str)
maturities = duration_sorter(df["maturity"].unique().tolist())
countries: list = (
df["country"].unique().tolist() if "country" in df.columns else []
)
# Use the supplied colors, if any.
colors = kwargs.get("colors", [])
if not colors:
colors = LARGE_CYCLERView on GitHub (pinned to 3e071fcc2c)
Solutions
- Chart the actual curve endpoints (obb.fixedincome.government.curve) whose models include maturity, rate, date.
- Rename injected columns: df = df.rename(columns={'tenor': 'maturity'}) and ensure 'rate' and 'date' also exist (they are checked next).
- Check res.to_df().columns before calling the chart to confirm maturity/rate/date are present.
Example fix
# before
fig = views.fixedincome_curve(data=df) # df has 'tenor' instead of 'maturity'
# after
df = df.rename(columns={'tenor': 'maturity'})
fig = views.fixedincome_curve(data=df) Defensive patterns
Strategy: validation
Validate before calling
required = {'maturity', 'rate', 'date'}
df = res.to_df() if hasattr(res, 'to_df') else data
missing = required - set(df.columns)
assert not missing, f'curve chart missing columns: {sorted(missing)}' Type guard
def has_curve_columns(df) -> bool:
"""True when the frame carries maturity, rate, and date columns."""
return {'maturity', 'rate', 'date'}.issubset(getattr(df, 'columns', [])) Try / catch
try:
fig = views.fixedincome_curve(data=df)
except ValueError as e:
if 'Maturity column not found' in str(e):
fig = views.fixedincome_curve(data=df.rename(columns={'tenor': 'maturity'}))
else:
raise Prevention
- Rename tenor/term columns to 'maturity' before injecting custom curve data.
- Only route genuine curve datasets (maturity/rate/date) through the curve view.
- Check df.columns once when integrating a new provider.
When it happens
Trigger: Charting a fixedincome endpoint response that lacks per-tenor maturity rows (e.g. spot/par rates keyed differently); injecting a custom DataFrame with tenors named 'tenor' or 'term' instead of 'maturity'.
Common situations: Renaming columns during preprocessing, charting a non-curve fixedincome dataset (e.g. forecasting or custom rates) through the curve view, or provider schema changes dropping the maturity field.
Related errors
- Error: No data to plot.
- Column '{target_col}' not found in the data.
- No 'weight' column found in the data.
- Error: Rate column not found in the data.
- Error: Date column not found in the data.
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/ace022f8bc10c601.
Report an issue: GitHub.