stats: reformat file and fix some help messages

pull/1/head
Michael DM Dryden 2020-05-30 02:19:52 -04:00
rodzic c63fb3d138
commit e31231d70d
1 zmienionych plików z 11 dodań i 10 usunięć

Wyświetl plik

@ -140,7 +140,7 @@ class StatsRunner(object):
df['Percent'] = df['count'] / df['count'].sum() * 100
df = df[['user', 'count', 'Percent']]
df.columns = ['User', 'Total Messages', 'Percent']
df['User'] = df['User'].str.replace(r'[^\x00-\x7F]', "", regex=True)
df['User'] = df['User'].str.replace(r'[^\x00-\x7F]', "", regex=True) # Drop emoji
text = df.iloc[:n].to_string(index=False, header=True, float_format=lambda x: f"{x:.1f}")
@ -364,7 +364,8 @@ class StatsRunner(object):
return None, bio
def get_message_history(self, user: Tuple[int, str] = None, averages: int = None, start: str = None, end: str = None)\
def get_message_history(self, user: Tuple[int, str] = None, averages: int = None, start: str = None,
end: str = None) \
-> Tuple[None, BytesIO]:
"""
Make a plot of message history over time
@ -466,7 +467,7 @@ class StatsRunner(object):
raise HelpException("corr must be either pearson or spearman")
if not 0 <= thresh <= 1:
raise HelpException(f'n must be greater than 0, got: {n}')
raise HelpException(f'n must be in the range [0, 1], got: {n}')
query = f"""
SELECT msg_time, extract(ISODOW FROM msg_time) as dow, extract(HOUR FROM msg_time) as hour,