{"record":{"id":"16ee4f11cf6d28d9","repo":"OpenBB-finance/OpenBB","slug":"no-columns-matching-cols-were-found-in-the-dat","errorCode":null,"errorMessage":"No columns matching, {cols}, were found in the data.","messagePattern":"No columns matching, (.+?), were found in the data\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/obbject_extensions/charting/openbb_charting/charts/price_performance.py","lineNumber":62,"sourceCode":"    chart_df = DataFrame()\n\n    if \"symbol\" in data.columns:\n        data = data.set_index(\"symbol\")\n    chart_cols = []\n\n    if len(data) == 0:\n        raise ValueError(\"No data was found in the DataFrame.\")\n\n    data = data.drop_duplicates(keep=\"first\")\n\n    for col in cols:\n        if col in data.columns and data[col].notnull().any():\n            df[col.replace(\"_\", \" \").title() if col != \"ytd\" else col.upper()] = data[\n                col\n            ].apply(lambda x: round(x * 100, 4) if x is not None else None)\n\n    if df.empty:\n        raise ValueError(f\"No columns matching, {cols}, were found in the data.\")\n\n    chart_df = df.T\n    chart_cols = chart_df.columns.to_list()\n\n    if \"limit\" in kwargs and isinstance(kwargs.get(\"limit\"), int):\n        limit = kwargs.pop(\"limit\", 10)\n        chart_df = chart_df.head(limit)  # type: ignore\n\n    layout_kwargs: dict[str, Any] = kwargs.get(\"layout_kwargs\", {})\n\n    title = (\n        f\"{kwargs.pop('title')}\" if \"title\" in kwargs else \"Equity Price Performance\"\n    )\n    orientation = (\n        kwargs.pop(\"orientation\")\n        if \"orientation\" in kwargs and kwargs.get(\"orientation\") is not None\n        else \"v\"\n    )","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/obbject_extensions/charting/openbb_charting/charts/price_performance.py#L44-L80","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Rename your period columns to the expected labels: {'1D': 'one_day', '1W': 'one_week', '1M': 'one_month', ...}","Lowercase and snake_case all column names before passing data","Ensure at least one of the expected period columns has a non-null numeric value"],"exampleFix":"# before\ndf = my_perf_df  # columns: 1D, 1W, 1M\nres.charting(data=df)\n\n# after\nrename = {'1D': 'one_day', '1W': 'one_week', '1M': 'one_month'}\nres.charting(data=df.rename(columns=rename))","handlingStrategy":"validation","validationCode":"expected = ['one_day', 'one_week', 'one_month', 'three_month', 'six_month', 'ytd', 'one_year', 'two_year', 'three_year', 'four_year', 'five_year']\ncols = {c.lower() for c in df.columns}\nassert any(c in cols and df[c].notna().any() for c in expected), 'no recognized performance period columns'","typeGuard":"def has_performance_columns(df: pd.DataFrame) -> bool:\n    cols = {c.lower() for c in df.columns}\n    expected = {'one_day', 'one_week', 'one_month', 'ytd', 'one_year'}\n    return any(c in cols for c in expected)","tryCatchPattern":"try:\n    res.charting()\nexcept ValueError as e:\n    if 'No columns matching' in str(e):\n        res.charting(data=df.rename(columns=PERIOD_RENAME_MAP))","preventionTips":["Map provider period labels to one_day/one_week/... before charting","Lowercase + snake_case column names at ingest","Verify at least one period column has non-null numeric values"],"tags":["openbb","charting","price-performance","schema-mismatch"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}