{"record":{"id":"0b761f69a6977639","repo":"OpenBB-finance/OpenBB","slug":"data-supplied-does-not-match-the-expected-format","errorCode":null,"errorMessage":"Data supplied does not match the expected format.","messagePattern":"Data supplied does not match the expected format\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/technical/openbb_technical/technical_views.py","lineNumber":242,"sourceCode":"        from openbb_charting.core.chart_style import ChartStyle\n        from openbb_charting.core.openbb_figure import OpenBBFigure\n        from openbb_core.app.utils import basemodel_to_df\n        from pandas import DataFrame\n\n        data = kwargs.get(\"data\")\n\n        if isinstance(data, DataFrame) and not data.empty and \"window\" in data.columns:\n            df_ta = data.set_index(\"window\")\n        else:\n            df_ta = basemodel_to_df(kwargs[\"obbject_item\"], index=\"window\")  # type: ignore\n\n        df_ta.columns = [col.title().replace(\"_\", \" \") for col in df_ta.columns]\n\n        # Check if the data is formatted as expected.\n        if not all(\n            col in df_ta.columns for col in [\"Realized\", \"Min\", \"Median\", \"Max\"]\n        ):\n            raise ValueError(\"Data supplied does not match the expected format.\")\n\n        model = (\n            str(kwargs.get(\"model\"))\n            .replace(\"std\", \"Standard Deviation\")\n            .replace(\"_\", \"-\")\n            .title()\n            if kwargs.get(\"model\")\n            else \"Standard Deviation\"\n        )\n\n        symbol = str(kwargs.get(\"symbol\")) + \" - \" if kwargs.get(\"symbol\") else \"\"\n\n        title = (\n            str(kwargs.get(\"title\"))\n            if kwargs.get(\"title\")\n            else f\"{symbol}Realized Volatility Cones - {model} Model\"\n        )\n","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/technical/openbb_technical/technical_views.py#L224-L260","documentation":"Raised by the volatility (realized volatility) charting view when the converted DataFrame lacks any of the required columns 'Realized', 'Min', 'Median', 'Max' after title-casing and underscore-stripping the column names. The view plots a range chart of realized volatility statistics, so those four series must exist in the OBBject results (or the supplied DataFrame). Missing columns mean the underlying data is not realized-volatility output.","triggerScenarios":"Calling chart/volatility/realized on an OBBject whose results are not from the realized-volatility endpoint; passing a DataFrame via kwargs['data'] that lacks realized/min/median/max columns (window-indexed); using 'data' that has a 'window' column but different output names after provider schema changes.","commonSituations":"Charting the wrong OBBject (e.g. a normal historical price result); custom DataFrames fed to the volatility view; provider or extension version changes that rename output columns so the title-case mapping no longer matches.","solutions":["Ensure the OBBject comes from obb.technical.volatility.realized (its results contain the expected columns)","If passing data manually, rename your columns to 'realized', 'min', 'median', 'max' with a 'window' index before calling","Print df_ta.columns after conversion to see which expected label is missing and adapt"],"exampleFix":"# before\nres = obb.technical.volatility.realized(symbol='AAPL').charting()  # wrong/partial data\n\n# after\ndf = res.to_df()\ndf = df.rename(columns={'rv': 'realized', 'lo': 'min', 'mid': 'median', 'hi': 'max'})\nres.charting(data=df)","handlingStrategy":"validation","validationCode":"required = {'realized', 'min', 'median', 'max'}\nmissing = required - {c.lower() for c in df.columns}\nassert not missing, f'volatility chart missing columns: {missing}'","typeGuard":"def has_volatility_columns(df: pd.DataFrame) -> bool:\n    cols = {c.lower() for c in df.columns}\n    return {'realized', 'min', 'median', 'max'}.issubset(cols)","tryCatchPattern":"try:\n    res.charting()\nexcept ValueError as e:\n    if 'expected format' in str(e):\n        print(df.columns); raise","preventionTips":["Only chart realized-volatility endpoint results with this view","Rename custom columns to realized/min/median/max before charting","Pin extension versions so output schemas stay stable"],"tags":["openbb","charting","volatility","schema-mismatch"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}