def wmean_grouped2(group, var_name_in, var_name_weight):
    d = group[var_name_in]
w = group[var_name_weight]
return (d * w).sum() / w.sum()
FUNCS = {'mean': np.mean, 'sum': np.sum, 'count': np.count_nonzero}

def my_summary2(data, var_names_in, var_names_out, var_functions,
    var_name_weight=None, var_names_group=None):
    result = pd.DataFrame()
if var_names_group is None:
    pass
Создание частичной замены SAS PROC SUMMARY в Python/Pandas