Refactor sum calculation in README example for clarity

This commit is contained in:
Palash Tyagi 2025-04-26 17:22:48 +01:00
parent 0856364f4c
commit fb6ebdf69b

View File

@ -67,7 +67,7 @@ let fb = Frame::new(mb, col_names, Some(RowIndex::Date(dates)));
// Math that reads like math // Math that reads like math
let result = &fa * &fb; // elementwise multiply let result = &fa * &fb; // elementwise multiply
let total = result.matrix().sum_vertical().iter().sum::<f64>(); let total = result.sum_vertical().iter().sum::<f64>();
assert_eq!(total, 184.0); assert_eq!(total, 184.0);
let result = &ma + 1.0; // add scalar let result = &ma + 1.0; // add scalar