{"record":{"id":"47358d2d46c9af55","repo":"OpenBB-finance/OpenBB","slug":"error-date-column-not-found-in-the-data","errorCode":null,"errorMessage":"Error: Date column not found in the data.","messagePattern":"Error: Date 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":53,"sourceCode":"                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)\n        figure.update_layout(ChartStyle().plotly_template.get(\"layout\", {}))\n        text_color = \"white\" if ChartStyle().plt_style == \"dark\" else \"black\"\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/fixedincome/openbb_fixedincome/fixedincome_views.py#L35-L71","documentation":"Raised by the OpenBB fixedincome charting view when the assembled DataFrame has no 'date' column. The plotter converts df['date'] to string and uses it to group/plot rate series over time, so a missing date column is fatal. It indicates the underlying provider data or the passed obbject_item models do not carry a date field.","triggerScenarios":"Calling the fixedincome chart view with a provider whose Data model omits 'date'; charting an OBBject fetched from a snapshot/point-in-time endpoint that returns only maturity and rate; passing kwargs['obbject_item'] with models whose model_dump() excludes dates.","commonSituations":"Mixing a point-in-time curve endpoint with the time-series chart view; provider schema drift after an upgrade; using a custom provider that never implemented the date field.","solutions":["Check res.to_df().columns and confirm a 'date' column exists before calling the charting view.","Use a time-series rates endpoint/provider that returns dated observations rather than a single-curve snapshot.","If your data legitimately has one date, re-fetch with a start_date so the provider populates the date column.","Align openbb-fixedincome and provider extension versions so the expected schema includes 'date'."],"exampleFix":"# before\nres = obb.fixedincome.rate.custom_curve(provider=\"x\")  # no date column\nres.charting.show()\n\n# after\nres = obb.fixedincome.rate.custom_curve(provider=\"x\", start_date=\"2024-01-01\")\ndf = res.to_df()\nif \"date\" not in df.columns:\n    raise SystemExit(\"provider returned no dates; pick a time-series provider\")\nres.charting.show()","handlingStrategy":"validation","validationCode":"REQUIRED = {\"maturity\", \"rate\", \"date\"}\n\ndef can_plot_rates(df) -> bool:\n    return REQUIRED.issubset(set(df.columns)) and not df.empty and df[\"date\"].notna().any()","typeGuard":"def has_dated_rate_series(df) -> bool:\n    cols = set(map(str, df.columns))\n    return {\"maturity\", \"rate\", \"date\"}.issubset(cols) and not df.empty","tryCatchPattern":"try:\n    res.charting.show()\nexcept ValueError as e:\n    if \"Date column not found\" in str(e):\n        print(\"Provider returned no dates; use a time-series endpoint with start_date\")\n    else:\n        raise","preventionTips":["Fetch time-series rates with an explicit start_date so providers populate the date column.","Never chart snapshot endpoints through the time-series chart view.","Check df.columns for 'date' first when switching providers."],"tags":["openbb","fixedincome","charting","data-schema"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}