[O] Use github table format for tabulate

This commit is contained in:
Hykilpikonna
2021-11-24 19:36:08 -05:00
parent b845762754
commit 82207f951b
+2 -2
View File
@@ -76,7 +76,7 @@ def view_covid_tweets_freq(users: list[str],
# Top 20 # Top 20
r.print(f"20 Users of who post COVID-related tweets most frequently:") r.print(f"20 Users of who post COVID-related tweets most frequently:")
r.print(tabulate([[u[0], f'{u[1] * 100:.1f}%'] for u in user_frequency[:20]], r.print(tabulate([[u[0], f'{u[1] * 100:.1f}%'] for u in user_frequency[:20]],
['Username', 'Frequency'])) ['Username', 'Frequency'], tablefmt="github"))
# Save report # Save report
r.save() r.save()
@@ -119,7 +119,7 @@ def view_covid_tweets_pop(users: list[str],
# Top 20 # Top 20
r.print(f"20 Users of whose COVID-related posts are the most popular:") r.print(f"20 Users of whose COVID-related posts are the most popular:")
r.print(tabulate([[u[0], f'{u[1]:.2f}'] for u in user_popularity[:20]], r.print(tabulate([[u[0], f'{u[1]:.2f}'] for u in user_popularity[:20]],
['Username', 'Popularity Ratio'])) ['Username', 'Popularity Ratio'], tablefmt="github"))
r.print() r.print()
# Calculate statistics # Calculate statistics