OpenBB-finance/OpenBB · error · ValueError

Please make sure that the columns 'High', 'Low', and…

Error message

 Please make sure that the columns 'High', 'Low', and 'Close' are in the dataframe.

What it means

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.)

Solutions

  1. Provide a standard OHLC frame: columns named open, high, low, close (volume optional).
  2. Rename before charting: df.rename(columns={"high_price": "high", "close_price": "close"}).
  3. If your data is close-only, request only close-based indicators and pass high=False, low=False where the API allows it.
  4. Flatten MultiIndex columns to plain strings.

Example fix

# before
charting.to_chart(data=df_close_only, indicators={"atr": {}})  # ValueError: High/Low/Close

# after
df = df_close_only.rename(columns={"price": "close"})
charting.to_chart(data=df, indicators={"sma": {"length": 20}})  # close-only indicator
Defensive patterns

Strategy: validation

Validate before calling

cols = {str(c).lower() for c in df.columns}
need = set()
if indicators_requires_ohlc(indicators):
    need = {"high", "low", "close"}
missing = need - cols
if missing:
    df = df.rename(columns={c: c.replace("_price", "") for c in df.columns})

Type guard

def ohlc_frame(df: pd.DataFrame) -> bool:
    cols = {str(c).lower() for c in df.columns}
    return {"high", "low"} <= cols and bool(cols & {"close", "adj close", "adj_close"})

Try / catch

try:
    charting.to_chart(data=df, indicators=indicators)
except ValueError as e:
    if "High" in str(e) and "Close" in str(e):
        indicators = {k: v for k, v in indicators.items() if k in ("sma", "ema", "rsi")}  # close-only
        charting.to_chart(data=df, indicators=indicators)
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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

Appendix: source

Thrown at openbb_platform/obbject_extensions/charting/openbb_charting/core/plotly_ta/ta_helpers.py:42

    Returns
    -------
    Optional[str]
        The name of the close column, none if df is invalid
    """
    # pylint: disable=import-outside-toplevel
    import re

    close_regex = r"(Adj\sClose|adj_close|Close)"
    # pylint: disable=too-many-boolean-expressions
    if (
        (re.findall(r"High", str(data.columns), re.IGNORECASE) is None and high)
        or (re.findall(r"Low", str(data.columns), re.IGNORECASE) is None and low)
        or (close_col := re.findall(close_regex, str(data.columns), re.IGNORECASE))
        is None
        and close
    ):
        raise ValueError(
            " Please make sure that the columns 'High', 'Low', and 'Close' are in the dataframe."
        )

    close_col = [col for col in close_col if col in data.columns]

    # giving priority to the standard close column
    if "close" in close_col:
        return "close"

    return close_col[-1]

View on GitHub (pinned to 3e071fcc2c)