OpenBB-finance/OpenBB · error · ValueError
Data must be a list of Data objects or a DataFrame with a 'd
Error message
Data must be a list of Data objects or a DataFrame with a 'date' column.
What it means
Raised in RelativeRotation (__init__) when the supplied data could not be converted into a usable DataFrame: it accepts an OBBject, a list of Data models/dicts, or a DataFrame, and after conversion attempts df is still empty. This usually means the input shape was not one of the supported forms (or conversion silently failed via contextlib.suppress).
Source
Thrown at openbb_platform/extensions/technical/openbb_technical/relative_rotation.py:287
target_col = "volume" if study == "volume" else "close"
if isinstance(data, OBBject):
data = data.results # type: ignore
if isinstance(data, list) and (
all(isinstance(d, Data) for d in data)
or all(isinstance(d, dict) for d in data)
):
with contextlib.suppress(Exception):
df = basemodel_to_df(convert_to_basemodel(data), index="date")
if isinstance(data, DataFrame) and not df.empty:
df = data.copy()
if "date" in df.columns:
df.set_index("date", inplace=True)
if df.empty:
raise ValueError(
"Data must be a list of Data objects or a DataFrame with a 'date' column."
)
if "symbol" in df.columns:
df = df.pivot(columns="symbol", values=target_col)
if benchmark not in df.columns:
raise RuntimeError("The benchmark symbol was not found in the data.")
benchmark_data = df.pop(benchmark).to_frame()
symbols_data = df
if len(symbols_data) <= 252 and study in ["price", "volume"]: # type: ignore
raise ValueError(
"Supplied data must be daily intervals and have more than one year of back data to calculate"
" the most recent day in the time series."
)
View on GitHub (pinned to 3e071fcc2c)
Solutions
- Pass the OBBject directly (RelativeRotation accepts it) rather than manually extracting pieces.
- Ensure the list items are Data model instances or dicts containing a 'date' field (lowercase).
- If passing a DataFrame, include a 'date' column and 'symbol' column.
- Check that the upstream historical fetch actually returned rows before constructing the RRG.
Example fix
# before rrg = RelativeRotation(data=res.to_df().drop(columns=["date"]), benchmark="SPY") # date dropped # after rrg = RelativeRotation(data=res, benchmark="SPY") # pass OBBject with date intact
Defensive patterns
Strategy: validation
Validate before calling
assert df is not None and not df.empty and "date" in getattr(df, "columns", []), "RRG needs non-empty data with a date field"
Type guard
def rrg_input_valid(data) -> bool:
if hasattr(data, "results"):
data = data.results
return bool(data) and not getattr(data, "empty", False) Try / catch
try:
rrg = RelativeRotation(data=data, benchmark="SPY")
except ValueError as e:
if "list of Data objects" in str(e):
df = normalize_to_df_with_date(data) # ensure 'date' column, then retry
rrg = RelativeRotation(data=df, benchmark="SPY")
else:
raise Prevention
- Pass the OBBject straight from the fetch call
- Guarantee a lowercase 'date' field in list inputs
- Check fetch results are non-empty before RRG construction
When it happens
Trigger: Calling RelativeRotation with an empty list, a list of non-Data/non-dict items, a DataFrame lacking a 'date' column and with empty content, or a dict that basemodel_to_df cannot index by 'date'.
Common situations: Passing provider results whose 'date' field is named differently ('Date', 'timestamp'); passing raw JSON arrays of strings; empty responses from an upstream fetch (no data returned for the symbols); passing OBBject whose .results is empty.
Related errors
- The benchmark symbol was not found in the data.
- Supplied data must be daily intervals and have more than one
- Supplied data must be daily intervals and have more than two
- At least one extension type must be selected.
- Incorrect email or password
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/f892da9d74e95706.
Report an issue: GitHub.