stats: Add total row to get_stats_type output

pull/1/head
Michael DM Dryden 2020-06-06 18:14:16 -04:00
rodzic 4815fd7d79
commit 0734ca9248
1 zmienionych plików z 3 dodań i 0 usunięć

Wyświetl plik

@ -706,6 +706,9 @@ class StatsRunner(object):
df_u.columns = ['type', 'User Count', 'User Percent']
df = df.merge(df_u, on="type", how="outer")
a = list(zip(df.columns.values, ["Total"] + df.iloc[:, 1:].sum().to_list()))
df = df.append({key: value for key, value in a}, ignore_index=True)
text = df.to_string(index=False, header=True, float_format=lambda x: f"{x:.1f}")
if user: