Skip to content

Handling Missing values  #15

@harsh47

Description

@harsh47

I think this fixes the problem of missing values. Is it correct way of handling missing values ?

def wavg(group, avg_name, weight_name):
    import numpy as np 
        group=group[np.isfinite(group[avg_name])] # ignores missing values 

    d = group[avg_name]
    w = group[weight_name]
    try:
        return (d * w).sum() / w.sum()
    except ZeroDivisionError:
        return d.mean()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions