OpenBB-finance/OpenBB · error · ValueError
No close column found in dataframe
Error message
No close column found in dataframe
What it means
PlotlyTA(data_classes.py:276) requires an identifiable close column: it calls check_columns(df_ta) (plotly_ta/ta_helpers.py) which searches for a column matching 'Adj Close', 'adj_close', or 'Close' case-insensitively. If none is found the constructor raises ValueError("No close column found in dataframe") because nearly every technical indicator (ad, adosc, adx, atr, cci, kc, obv, ...) needs close prices.
Solutions
- Rename the price column before charting: df = df.rename(columns={"last": "close"}).
- If columns are MultiIndex/tuples, flatten them to plain strings first (df.columns = df.columns.get_level_values(0)).
- Pass a standard OHLC frame (open/high/low/close, volume) from the router instead of a hand-built one.
- Disable indicators if you only want candles: indicators={}
Example fix
# before
PlotlyTA(df_ta=df, indicators={"sma": {}}) # ValueError: No close column found in dataframe
# after
df = df.rename(columns={"last": "close"})
PlotlyTA(df_ta=df, indicators={"sma": {}}) Defensive patterns
Strategy: validation
Validate before calling
import re
CLOSE_RE = re.compile(r"(Adj\sClose|adj_close|Close)", re.IGNORECASE)
def has_close_column(df) -> bool:
return any(CLOSE_RE.search(c) for c in map(str, df.columns))
if not has_close_column(df):
df = df.rename(columns={"last": "close"}) Type guard
def ta_frame(df: pd.DataFrame) -> bool:
cols = {str(c).lower() for c in df.columns}
return bool(cols & {"close", "adj close", "adj_close"}) Try / catch
try:
ta = PlotlyTA(df_ta=df, indicators=indicators)
except ValueError as e:
if "close column" in str(e):
raise ValueError("charting requires a close column; rename your price column") from e
raise Prevention
- Standardize frames to lowercase open/high/low/close/volume before charting.
- Flatten MultiIndex columns to plain strings.
- When piping provider data, verify the close field survived transform_data.
When it happens
Trigger: Constructing PlotlyTA (directly or via charting with indicators) on a DataFrame whose price column is named differently — e.g. 'last', 'price', '4. close', or a localized name — or one that only has volume.
Common situations: Feeding charting output from a custom provider whose Close field was renamed during transform_data; using intraday frames where the provider emits 'close' only after normalization that was skipped; passing symbol-keyed multi-level columns so str(columns) no longer matches the regex cleanly.
Related errors
- Please make sure that the columns 'High', 'Low', and…
- Error processing indicator
- Please provide data with only one symbol and columns for…
- Unknown indicator
- Error adding trend line
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/c2be5f04c967c42b.
Report an issue: GitHub.
Appendix: source
Thrown at openbb_platform/obbject_extensions/charting/openbb_charting/core/plotly_ta/data_classes.py:276
ma_mode: list[str] | None = None,
):
"""Initialize."""
# pylint: disable=import-outside-toplevel
from pandas import DataFrame, Series # noqa
from openbb_charting.core.plotly_ta.ta_helpers import check_columns # noqa
if isinstance(df_ta, Series):
df_ta = df_ta.to_frame()
if not isinstance(indicators, ChartIndicators):
indicators = ChartIndicators.from_dict(indicators)
self.df_ta: DataFrame = df_ta
self.indicators: ChartIndicators = indicators
self.ma_mode: list[str] = ma_mode or ["sma", "ema", "wma", "hma", "zlma", "rma"]
self.close_col = check_columns(df_ta)
if self.close_col is None:
raise ValueError("No close column found in dataframe")
self.columns: dict[str, list[str]] = {
"ad": ["high", "low", self.close_col, "volume"],
"adosc": ["high", "low", self.close_col, "volume"],
"adx": ["high", "low", self.close_col],
"aroon": ["high", "low"],
"atr": ["high", "low", self.close_col],
"cci": ["high", "low", self.close_col],
"donchian": ["high", "low"],
"fisher": ["high", "low"],
"kc": ["high", "low", self.close_col],
"obv": [self.close_col, "volume"],
"stoch": ["high", "low", self.close_col],
"vwap": ["high", "low", self.close_col, "volume"],
}
self.has_volume = "volume" in df_ta.columns and bool(df_ta["volume"].sum() > 0)
View on GitHub (pinned to 3e071fcc2c)