Update 'videotron1.py'
adding a total and changing the loop to display KB/MB.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user