{"record":{"id":"4ebf8214153d90d3","repo":"OpenBB-finance/OpenBB","slug":"the-expected-column-labels-check-columns-were","errorCode":null,"errorMessage":"The expected column labels, {check_columns}, were not found in DataFrame.","messagePattern":"The expected column labels, (.+?), were not found in DataFrame\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/obbject_extensions/charting/openbb_charting/charts/helpers.py","lineNumber":89,"sourceCode":"    ----------\n    data: DataFrame\n        DataFrame containing OHLC data.\n\n    Returns\n    -------\n    DataFrame\n        DataFrame copy with Heikin Ashi candle calculations.\n    \"\"\"\n    # pylint: disable=import-outside-toplevel\n    from pandas_ta import candles\n\n    df = data.copy()\n\n    check_columns = [\"open\", \"high\", \"low\", \"close\"]\n\n    for item in check_columns:\n        if item not in df.columns:\n            raise ValueError(\n                f\"The expected column labels, {check_columns}, were not found in DataFrame.\"\n            )\n\n    ha = candles.ha(\n        df[\"open\"],\n        df[\"high\"],\n        df[\"low\"],\n        df[\"close\"],\n    )\n\n    for item in check_columns:\n        df[item] = ha[f\"HA_{item}\"]\n\n    return df\n\n\ndef duration_sorter(durations: list) -> list:\n    \"\"\"Sort durations labeled as month_5, year_5, etc.\"\"\"","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/obbject_extensions/charting/openbb_charting/charts/helpers.py#L71-L107","documentation":"calculate_heikin_ashi in openbb_charting/charts/helpers.py verifies that open, high, low, close columns (lowercase) all exist before delegating to pandas_ta's candles.ha. If any OHLC label is missing (uppercase, renamed, or absent), the ValueError lists the expected labels so the caller can fix the frame's schema.","triggerScenarios":"Calling the candle/Heikin Ashi chart with columns named 'Open','High','Low','Close' (title case from providers or CSV); frames where 'close' exists but 'open' was dropped; charting an endpoint whose output schema lacks full OHLC (e.g. index prices with only close).","commonSituations":"CSV/Excel imports producing capitalized headers; provider schemas using 'adj_close' or omitting 'open'; custom DataFrames from screeners with partial price data.","solutions":["Lowercase the columns: df.columns = df.columns.str.lower()","Rename alternative labels: df = df.rename(columns={'Open': 'open', 'High': 'high', 'Low': 'low', 'Close': 'close'})","Ensure the source endpoint returns full OHLC data before requesting candles"],"exampleFix":"# before\nfig = charting.create_candle_chart(data=df)  # columns: Open/High/Low/Close\n\n# after\ndf.columns = df.columns.str.lower()\nfig = charting.create_candle_chart(data=df)","handlingStrategy":"validation","validationCode":"ohlc = {'open', 'high', 'low', 'close'}\nmissing = ohlc - {c.lower() for c in df.columns}\nassert not missing, f'missing OHLC columns: {missing}'\ndf.columns = df.columns.str.lower()","typeGuard":"def is_ohlc_frame(df: pd.DataFrame) -> bool:\n    cols = {c.lower() for c in df.columns}\n    return {'open', 'high', 'low', 'close'}.issubset(cols)","tryCatchPattern":"try:\n    fig = create_candle_chart(data=df)\nexcept ValueError as e:\n    if 'expected column labels' in str(e):\n        fig = create_candle_chart(data=df.rename(columns=str.lower))","preventionTips":["Normalize column names to lowercase on ingest","Validate full OHLC presence before candle charts","Use endpoints that return complete OHLC data"],"tags":["openbb","charting","heikin-ashi","column-case"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}