OpenBB-finance/OpenBB · error · ValueError

No columns matching, {cols}, were found in the data.

Error message

No columns matching, {cols}, were found in the data.

What it means

After dropping empty rows, the price-performance chart builds df from any of the fixed columns one_day..five_year/ytd. If none of those recognized labels exist with at least one non-null value, df stays empty and this ValueError lists the expected column set. The data reached the view but its schema does not match performance-period columns (wrong case, renamed, or a different endpoint's data).

Source

Thrown at openbb_platform/obbject_extensions/charting/openbb_charting/charts/price_performance.py:62

    chart_df = DataFrame()

    if "symbol" in data.columns:
        data = data.set_index("symbol")
    chart_cols = []

    if len(data) == 0:
        raise ValueError("No data was found in the DataFrame.")

    data = data.drop_duplicates(keep="first")

    for col in cols:
        if col in data.columns and data[col].notnull().any():
            df[col.replace("_", " ").title() if col != "ytd" else col.upper()] = data[
                col
            ].apply(lambda x: round(x * 100, 4) if x is not None else None)

    if df.empty:
        raise ValueError(f"No columns matching, {cols}, were found in the data.")

    chart_df = df.T
    chart_cols = chart_df.columns.to_list()

    if "limit" in kwargs and isinstance(kwargs.get("limit"), int):
        limit = kwargs.pop("limit", 10)
        chart_df = chart_df.head(limit)  # type: ignore

    layout_kwargs: dict[str, Any] = kwargs.get("layout_kwargs", {})

    title = (
        f"{kwargs.pop('title')}" if "title" in kwargs else "Equity Price Performance"
    )
    orientation = (
        kwargs.pop("orientation")
        if "orientation" in kwargs and kwargs.get("orientation") is not None
        else "v"
    )

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Rename your period columns to the expected labels: {'1D': 'one_day', '1W': 'one_week', '1M': 'one_month', ...}
  2. Lowercase and snake_case all column names before passing data
  3. Ensure at least one of the expected period columns has a non-null numeric value

Example fix

# before
df = my_perf_df  # columns: 1D, 1W, 1M
res.charting(data=df)

# after
rename = {'1D': 'one_day', '1W': 'one_week', '1M': 'one_month'}
res.charting(data=df.rename(columns=rename))
Defensive patterns

Strategy: validation

Validate before calling

expected = ['one_day', 'one_week', 'one_month', 'three_month', 'six_month', 'ytd', 'one_year', 'two_year', 'three_year', 'four_year', 'five_year']
cols = {c.lower() for c in df.columns}
assert any(c in cols and df[c].notna().any() for c in expected), 'no recognized performance period columns'

Type guard

def has_performance_columns(df: pd.DataFrame) -> bool:
    cols = {c.lower() for c in df.columns}
    expected = {'one_day', 'one_week', 'one_month', 'ytd', 'one_year'}
    return any(c in cols for c in expected)

Try / catch

try:
    res.charting()
except ValueError as e:
    if 'No columns matching' in str(e):
        res.charting(data=df.rename(columns=PERIOD_RENAME_MAP))

Prevention

When it happens

Trigger: Charting a price-performance OBBject from a provider that uses different period labels (e.g. '1D', '1W' or 'period_1d'); passing a custom DataFrame via data kwarg without the one_day/one_week/... columns; title-case columns ('One Day') not matching the lowercase check.

Common situations: Custom provider mappings with localized or shortened period names; DataFrames built by hand for dashboards; older payloads where ytd or multi-year columns were dropped, leaving only unrecognized ones.

Related errors


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