OpenBB-finance/OpenBB · error · ValueError

Error: Rate column not found in the data.

Error message

Error: Rate column not found in the data.

What it means

Raised by the OpenBB fixedincome charting view when building a yield-curve/rate chart from the fetched data table and no 'rate' column is present. The view requires at minimum 'maturity', 'rate', and 'date' columns to plot rates over maturities. It means the data returned by the router (or passed via obbject_item) does not match the shape the plotter expects, usually because the provider returned an error object or a different schema.

Source

Thrown at openbb_platform/extensions/fixedincome/openbb_fixedincome/fixedincome_views.py:50

        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_CYCLER
        color_count = 0

        figure = OpenBBFigure().create_subplots(shared_xaxes=True)

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Inspect df.columns before charting: print the OBBject.to_df() columns and confirm 'rate' exists for your provider.
  2. Switch to a provider whose fixedincome Data model includes a 'rate' field (check the provider's Fetcher/Data schema).
  3. If consuming an existing OBBject, ensure the data was fetched from a rates endpoint that populates 'rate', not a metadata-only endpoint.
  4. Upgrade openbb-platform and the fixedincome/provider extensions so router and provider schemas agree.

Example fix

# before
res = obb.fixedincome.rate.ameribor(provider="some_provider")
res.charting.show()

# after
df = res.to_df()
assert {"maturity", "rate", "date"}.issubset(df.columns), f"missing columns: {df.columns.tolist()}"
res.charting.show()
Defensive patterns

Strategy: validation

Validate before calling

from openbb_core.app.model.obbject import OBBject

REQUIRED_RATE_COLS = {"maturity", "rate", "date"}

def has_rate_chart_columns(res: OBBject) -> bool:
    df = res.to_df()
    return not df.empty and REQUIRED_RATE_COLS.issubset(set(df.columns))

# before charting:
# assert has_rate_columns(res), f"got columns: {res.to_df().columns.tolist()}"

Type guard

def is_rate_chart_data(df) -> bool:
    """True when the DataFrame can feed the fixedincome rate chart."""
    return isinstance(df.columns, object) and {"maturity", "rate", "date"}.issubset(map(str, df.columns)) and not df.empty

Try / catch

try:
    res.charting.show()
except ValueError as e:
    if "column not found" in str(e):
        raise SystemExit(f"Schema mismatch for charting: {e}. Columns: {res.to_df().columns.tolist()}") from e
    raise

Prevention

When it happens

Trigger: Calling the fixedincome rate charting/quantitative view (e.g. economy.fixedincome or the chart() path in openbb_fixedincome/fixedincome_views.py) with a provider whose Data model lacks a 'rate' field; passing kwargs['obbject_item'] entries whose model_dump() has no 'rate' key; a provider returning an empty-schema DataFrame that is non-empty of metadata but has no rate column.

Common situations: Using a provider that returns yields under a different column name (e.g. 'yield' or 'value'); an OpenBB Core version mismatch where the Data model changed field names; calling .charting() on an OBBject whose data came from an unsupported provider.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/1877f9bd20a08e64. Report an issue: GitHub.