moved top_cancellations to worst_offesnes in MsgData
This commit is contained in:
15
msg.py
15
msg.py
@@ -114,6 +114,19 @@ class MsgData:
|
||||
)
|
||||
return res
|
||||
|
||||
def worst_offsenses(self, user: str, days: int):
|
||||
cdf = self.cancellations(days=days)
|
||||
cdf = cdf[cdf['display_name'].str.contains(user, case=False)]
|
||||
|
||||
if cdf.shape[0] > 0:
|
||||
res = f'{user}\'s top 5 cancellations in the last {days} days:\n'
|
||||
res += f'\n'.join(
|
||||
f'`{row["count"]:<2.0f}cancellations`\n{row["link"]}' for idx, row in cdf.iloc[:5].iterrows())
|
||||
else:
|
||||
res = f'No cancellations for {user} in the past {days} days'
|
||||
|
||||
return res
|
||||
|
||||
|
||||
async def message_df(client: discord.Client, **kwargs):
|
||||
return pd.DataFrame(
|
||||
@@ -203,7 +216,7 @@ def cancelled_totals(cdf: pd.DataFrame) -> pd.DataFrame:
|
||||
return pd.DataFrame({
|
||||
'total': totals,
|
||||
'max channel': max_channels,
|
||||
'worst': cdf.groupby('display_name').max()['link']
|
||||
# 'worst': cdf.groupby('display_name').max()['link']
|
||||
}).sort_values('total', ascending=False)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user