Raphtory icon indicating copy to clipboard operation
Raphtory copied to clipboard

Balance only seems to work for float properties

Open narnolddd opened this issue 2 years ago • 0 comments

Was working with the python version, it returns 0.0 for balance if the property is an integer. I think the problem is when it casts into_f64 it only works if the property is an f64 one. I guess the tricky part is if you're doing things with integers you need to worry about signed/unsigned etc.

            .flat_map(|prop| {
                prop.temporal().get(name).map(|val| {
                    val.values()
                        .into_iter()
                        .map(|valval| valval.into_f64().unwrap_or(0.0f64))
                        .sum::<f64>()
                })

where into_f64 is

    fn into_f64(self) -> Option<f64> {
        if let Prop::F64(v) = self {
            Some(v)
        } else {
            None
        }
    }

(not a problem for me right now as I can just cast the column as float before)

narnolddd avatar Dec 04 '23 13:12 narnolddd