diff --git a/src/utils/qdf/core.rs b/src/utils/qdf/core.rs index 136755e..545c9c7 100644 --- a/src/utils/qdf/core.rs +++ b/src/utils/qdf/core.rs @@ -17,14 +17,15 @@ use std::error::Error; pub fn check_quantamental_dataframe(df: &DataFrame) -> Result<(), Box> { let expected_cols = ["real_date", "cid", "xcat"]; let expected_dtype = [DataType::Date, DataType::String, DataType::String]; + let err = "Quantamental DataFrame must have at least 4 columns: 'real_date', 'cid', 'xcat' and one or more metrics."; for (col, dtype) in expected_cols.iter().zip(expected_dtype.iter()) { let col = df.column(col); if col.is_err() { - return Err(format!("Column {:?} not found", col).into()); + return Err(format!("{} Column {:?} not found", err, col).into()); } let col = col?; if col.dtype() != dtype { - return Err(format!("Column {:?} has wrong dtype", col).into()); + return Err(format!("{} Column {:?} has wrong dtype", err, col).into()); } } Ok(())