OpenBB-finance/OpenBB · error · ValueError

Error: Date column not found in the data.

Error message

Error: Date column not found in the data.

What it means

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.

Source

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

                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)
        figure.update_layout(ChartStyle().plotly_template.get("layout", {}))
        text_color = "white" if ChartStyle().plt_style == "dark" else "black"

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Check res.to_df().columns and confirm a 'date' column exists before calling the charting view.
  2. Use a time-series rates endpoint/provider that returns dated observations rather than a single-curve snapshot.
  3. If your data legitimately has one date, re-fetch with a start_date so the provider populates the date column.
  4. Align openbb-fixedincome and provider extension versions so the expected schema includes 'date'.

Example fix

# before
res = obb.fixedincome.rate.custom_curve(provider="x")  # no date column
res.charting.show()

# after
res = obb.fixedincome.rate.custom_curve(provider="x", start_date="2024-01-01")
df = res.to_df()
if "date" not in df.columns:
    raise SystemExit("provider returned no dates; pick a time-series provider")
res.charting.show()
Defensive patterns

Strategy: validation

Validate before calling

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

def can_plot_rates(df) -> bool:
    return REQUIRED.issubset(set(df.columns)) and not df.empty and df["date"].notna().any()

Type guard

def has_dated_rate_series(df) -> bool:
    cols = set(map(str, df.columns))
    return {"maturity", "rate", "date"}.issubset(cols) and not df.empty

Try / catch

try:
    res.charting.show()
except ValueError as e:
    if "Date column not found" in str(e):
        print("Provider returned no dates; use a time-series endpoint with start_date")
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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