{"record":{"id":"09246303ffd3d423","repo":"OpenBB-finance/OpenBB","slug":"please-make-sure-that-the-columns-high-low","errorCode":null,"errorMessage":" Please make sure that the columns 'High', 'Low', and 'Close' are in the dataframe.","messagePattern":" Please make sure that the columns 'High', 'Low', and 'Close' are in the dataframe\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/obbject_extensions/charting/openbb_charting/core/plotly_ta/ta_helpers.py","lineNumber":42,"sourceCode":"\n    Returns\n    -------\n    Optional[str]\n        The name of the close column, none if df is invalid\n    \"\"\"\n    # pylint: disable=import-outside-toplevel\n    import re\n\n    close_regex = r\"(Adj\\sClose|adj_close|Close)\"\n    # pylint: disable=too-many-boolean-expressions\n    if (\n        (re.findall(r\"High\", str(data.columns), re.IGNORECASE) is None and high)\n        or (re.findall(r\"Low\", str(data.columns), re.IGNORECASE) is None and low)\n        or (close_col := re.findall(close_regex, str(data.columns), re.IGNORECASE))\n        is None\n        and close\n    ):\n        raise ValueError(\n            \" Please make sure that the columns 'High', 'Low', and 'Close' are in the dataframe.\"\n        )\n\n    close_col = [col for col in close_col if col in data.columns]\n\n    # giving priority to the standard close column\n    if \"close\" in close_col:\n        return \"close\"\n\n    return close_col[-1]\n","sourceCodeStart":24,"sourceCodeEnd":53,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/obbject_extensions/charting/openbb_charting/core/plotly_ta/ta_helpers.py#L24-L53","documentation":"check_columns in plotly_ta/ta_helpers.py:42 guards the minimum OHLC inputs for TA charting: it regex-searches str(data.columns) for High, Low, and a close variant (Adj Close / adj_close / Close). When the compound condition trips it raises ValueError(\" Please make sure that the columns 'High', 'Low', and 'Close' are in the dataframe.\") — the frame passed to the TA engine does not carry the columns the indicators expect. (Note the condition itself is fragile: re.findall returns a list, never None, so in practice it fires via the close_col clause downstream or when defaults high/low are requested on a frame without those columns.)","triggerScenarios":"Calling charting with TA indicators on a close-only or price-only DataFrame (no 'high'/'low'), or on a frame with renamed columns such as 'High Price'/'Adj_Close' variants the regexes miss.","commonSituations":"Index/economic series routed through charting with a default indicator set; provider data whose transform renamed OHLC columns; DataFrames with MultiIndex columns that stringify oddly.","solutions":["Provide a standard OHLC frame: columns named open, high, low, close (volume optional).","Rename before charting: df.rename(columns={\"high_price\": \"high\", \"close_price\": \"close\"}).","If your data is close-only, request only close-based indicators and pass high=False, low=False where the API allows it.","Flatten MultiIndex columns to plain strings."],"exampleFix":"# before\ncharting.to_chart(data=df_close_only, indicators={\"atr\": {}})  # ValueError: High/Low/Close\n\n# after\ndf = df_close_only.rename(columns={\"price\": \"close\"})\ncharting.to_chart(data=df, indicators={\"sma\": {\"length\": 20}})  # close-only indicator","handlingStrategy":"validation","validationCode":"cols = {str(c).lower() for c in df.columns}\nneed = set()\nif indicators_requires_ohlc(indicators):\n    need = {\"high\", \"low\", \"close\"}\nmissing = need - cols\nif missing:\n    df = df.rename(columns={c: c.replace(\"_price\", \"\") for c in df.columns})","typeGuard":"def ohlc_frame(df: pd.DataFrame) -> bool:\n    cols = {str(c).lower() for c in df.columns}\n    return {\"high\", \"low\"} <= cols and bool(cols & {\"close\", \"adj close\", \"adj_close\"})","tryCatchPattern":"try:\n    charting.to_chart(data=df, indicators=indicators)\nexcept ValueError as e:\n    if \"High\" in str(e) and \"Close\" in str(e):\n        indicators = {k: v for k, v in indicators.items() if k in (\"sma\", \"ema\", \"rsi\")}  # close-only\n        charting.to_chart(data=df, indicators=indicators)\n    else:\n        raise","preventionTips":["Feed charting standard OHLC frames from provider output, not hand-built tables.","Check for high/low/close (case-insensitive) before requesting OHLC-based indicators.","Remember the close matcher accepts 'Adj Close', 'adj_close', and 'Close' only."],"tags":["python","openbb","charting","technical-analysis","data-validation"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}