{"record":{"id":"1877f9bd20a08e64","repo":"OpenBB-finance/OpenBB","slug":"error-rate-column-not-found-in-the-data","errorCode":null,"errorMessage":"Error: Rate column not found in the data.","messagePattern":"Error: Rate column not found in the data\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/fixedincome/openbb_fixedincome/fixedincome_views.py","lineNumber":50,"sourceCode":"        df: DataFrame = DataFrame()\n        if data:\n            if isinstance(data, DataFrame) and not data.empty:  # noqa: SIM108\n                df = data\n            elif isinstance(data, (list, Data)):\n                df = basemodel_to_df(data, index=None)  # type: ignore\n            else:\n                pass\n        else:\n            df = DataFrame([d.model_dump() for d in kwargs[\"obbject_item\"]])  # type: ignore\n\n        if df.empty:\n            raise ValueError(\"Error: No data to plot.\")\n\n        if \"maturity\" not in df.columns:\n            raise ValueError(\"Error: Maturity column not found in the data.\")\n\n        if \"rate\" not in df.columns:\n            raise ValueError(\"Error: Rate column not found in the data.\")\n\n        if \"date\" not in df.columns:\n            raise ValueError(\"Error: Date column not found in the data.\")\n\n        provider = kwargs.get(\"provider\")\n        df[\"date\"] = df[\"date\"].astype(str)\n        maturities = duration_sorter(df[\"maturity\"].unique().tolist())\n        countries: list = (\n            df[\"country\"].unique().tolist() if \"country\" in df.columns else []\n        )\n\n        # Use the supplied colors, if any.\n        colors = kwargs.get(\"colors\", [])\n        if not colors:\n            colors = LARGE_CYCLER\n        color_count = 0\n\n        figure = OpenBBFigure().create_subplots(shared_xaxes=True)","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/fixedincome/openbb_fixedincome/fixedincome_views.py#L32-L68","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect df.columns before charting: print the OBBject.to_df() columns and confirm 'rate' exists for your provider.","Switch to a provider whose fixedincome Data model includes a 'rate' field (check the provider's Fetcher/Data schema).","If consuming an existing OBBject, ensure the data was fetched from a rates endpoint that populates 'rate', not a metadata-only endpoint.","Upgrade openbb-platform and the fixedincome/provider extensions so router and provider schemas agree."],"exampleFix":"# before\nres = obb.fixedincome.rate.ameribor(provider=\"some_provider\")\nres.charting.show()\n\n# after\ndf = res.to_df()\nassert {\"maturity\", \"rate\", \"date\"}.issubset(df.columns), f\"missing columns: {df.columns.tolist()}\"\nres.charting.show()","handlingStrategy":"validation","validationCode":"from openbb_core.app.model.obbject import OBBject\n\nREQUIRED_RATE_COLS = {\"maturity\", \"rate\", \"date\"}\n\ndef has_rate_chart_columns(res: OBBject) -> bool:\n    df = res.to_df()\n    return not df.empty and REQUIRED_RATE_COLS.issubset(set(df.columns))\n\n# before charting:\n# assert has_rate_columns(res), f\"got columns: {res.to_df().columns.tolist()}\"","typeGuard":"def is_rate_chart_data(df) -> bool:\n    \"\"\"True when the DataFrame can feed the fixedincome rate chart.\"\"\"\n    return isinstance(df.columns, object) and {\"maturity\", \"rate\", \"date\"}.issubset(map(str, df.columns)) and not df.empty","tryCatchPattern":"try:\n    res.charting.show()\nexcept ValueError as e:\n    if \"column not found\" in str(e):\n        raise SystemExit(f\"Schema mismatch for charting: {e}. Columns: {res.to_df().columns.tolist()}\") from e\n    raise","preventionTips":["Inspect res.to_df().columns before calling any .charting() view.","Pin openbb platform + provider extension versions together so Data models stay aligned.","Prefer providers documented to return maturity/rate/date for rates endpoints."],"tags":["openbb","fixedincome","charting","data-schema"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}