Created
September 25, 2021 10:06
-
-
Save Abuton/6684a0c1e3f55aaeac61836ff96318a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_total_msg(user:str, df:pd.DataFrame) -> str: | |
""" | |
Return the total msgs 'user' has sent | |
Args: | |
---- | |
user: the user to extract his/her total count of messages | |
df: pd.DataFrame: dataframe that stores information about each user and message sent | |
Returns: | |
-------- | |
str | |
""" | |
try: | |
if user in df['Sender'].unique().tolist(): | |
text = f"{user} has sent a total message of {len(df[df['Sender'] == user])}" | |
else: st.info(f"{user} is not present in the data") | |
except Exception as e : st.warning('error', e) | |
return text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment