HKUDS/Vibe-Trading · error · ValueError
No common dates and assets between factor_panel and forward_
Error message
No common dates and assets between factor_panel and forward_returns
What it means
IC analysis correlates factor values with forward returns per date per shared asset set; if the intersection of dates or of column (asset) labels is empty, no correlation is computable.
Source
Thrown at agent/src/quantlib/factormodel.py:785
Returns:
:class:`FactorICResult` containing mean IC, IC IR, t-statistic, p-value,
higher moments, and full IC time series.
Raises:
ValueError: If inputs are empty, share no common dates or assets, or method is unknown.
"""
if method not in ("spearman", "pearson"):
raise ValueError(f"method must be 'spearman' or 'pearson', got {method!r}")
if factor_panel.empty or forward_returns.empty:
raise ValueError("factor_panel and forward_returns must be non-empty")
# Align dates and assets
common_dates = factor_panel.index.intersection(forward_returns.index)
common_assets = factor_panel.columns.intersection(forward_returns.columns)
if common_dates.empty or common_assets.empty:
raise ValueError("No common dates and assets between factor_panel and forward_returns")
f_sub = factor_panel.loc[common_dates, common_assets]
r_sub = forward_returns.loc[common_dates, common_assets]
ic_records: dict[object, float] = {}
for date in common_dates:
f_row = f_sub.loc[date].dropna()
r_row = r_sub.loc[date].dropna()
shared = f_row.index.intersection(r_row.index)
if len(shared) < min_cross_section:
continue
f_vals = f_row.loc[shared].to_numpy(dtype=float)
r_vals = r_row.loc[shared].to_numpy(dtype=float)
if method == "spearman":
f_vals = rankdata(f_vals)View on GitHub (pinned to 80ffdda44c)
Solutions
- Compare the index/column dtypes and values of both frames
- Normalize dates with pd.to_datetime on both indexes
- Map asset identifiers to a common scheme before the call
Example fix
# before ic = factor_ic_analysis(panel, rets) # after rets.index = pd.to_datetime(rets.index) rets = rets.rename(columns=id_map) ic = factor_ic_analysis(panel, rets)
Defensive patterns
Strategy: validation
Validate before calling
assert (factor_panel.index.intersection(forward_returns.index).size > 0
and factor_panel.columns.intersection(forward_returns.columns).size > 0) Prevention
- Standardize index dtype with pd.to_datetime at load
- Map both feeds to one asset identifier scheme
When it happens
Trigger: Panel dates are DatetimeIndex(2024-01) while returns use Timestamps, or asset tickers differ ('AAPL' vs 'AAPL_EQ').
Common situations: Date dtype mismatch (date vs datetime vs string) between data sources; one feed uses FIGI/ISIN while the other uses tickers.
Related errors
- portfolio_exposures and factor_returns share no factor; expo
- No matching assets between weights ({sorted(w_series.index)}
- No matching factors between exposures ({sorted(X.columns)})
- method must be 'spearman' or 'pearson', got {method!r}
- factor_panel and forward_returns must be non-empty
AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28).
Data as JSON: /api/errors/313cd3d43398d0e1.
Report an issue: GitHub.