fix(ml): detect all-NaN volume column (not just missing column)
The Pydantic model sets volume=None when absent, creating an all-NaN column rather than a missing column. Check isna().all() in addition to column existence.
This commit is contained in:
parent
317f925c43
commit
4c7b3f2676
1 changed files with 3 additions and 3 deletions
|
|
@ -60,9 +60,9 @@ def preprocess_candles(
|
|||
except Exception as e:
|
||||
raise ValueError(f"Candle data validation failed: {e}")
|
||||
|
||||
# Handle missing volume column - fill with 0 if absent
|
||||
if 'volume' not in df.columns:
|
||||
logger.warning("Volume column missing from candle data, filling with 0")
|
||||
# Handle missing or all-null volume column - fill with 0 if absent/empty
|
||||
if 'volume' not in df.columns or df['volume'].isna().all():
|
||||
logger.warning("Volume data missing from candles, filling with 0")
|
||||
df['volume'] = 0.0
|
||||
|
||||
# Get feature engineering config
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue