diff --git a/videotron1.py b/videotron1.py index fc35b6d..e67549a 100644 --- a/videotron1.py +++ b/videotron1.py @@ -51,4 +51,24 @@ while True: datasum = df.groupby('USER')['DATA'].sum( min_count=1).reset_index().sort_values(by='DATA') - print(datasum) + for index, row in datasum.iterrows(): + total_data = round(row['DATA']) + user = row['USER'] + + if total_data > 1024: + total_data_gb = total_data / 1024 + total_data_text = "{:.2f} GB".format(total_data_gb) + else: + total_data_text = "{} KB".format(total_data) + + print("{} \t {}".format(user, total_data_text)) + + total_data = round(df['DATA'].sum()) + + if total_data > 1024: + total_data_gb = total_data / 1024 + total_data_text = "{:.2f} GB".format(total_data_gb) + else: + total_data_text = "{} KB".format(total_data) + + print("Total Data Usage:", total_data_text)