diff --git a/.idea/straw2analysis.iml b/.idea/straw2analysis.iml index 594e7e8..89e730b 100644 --- a/.idea/straw2analysis.iml +++ b/.idea/straw2analysis.iml @@ -7,4 +7,8 @@ + + \ No newline at end of file diff --git a/features/communication.py b/features/communication.py index eb4d536..97d985d 100644 --- a/features/communication.py +++ b/features/communication.py @@ -7,6 +7,19 @@ from setup import db_engine, session def get_call_data(usernames: List) -> pd.DataFrame: + """ + Read the data from the calls table and return it in a dataframe. + + Parameters + ---------- + usernames: List + A list of usernames to put into the WHERE condition. + + Returns + ------- + df_calls: pd.DataFrame + A dataframe of call data. + """ query_calls = ( session.query(Call, Participant.username) .filter(Participant.id == Call.participant_id) @@ -18,7 +31,19 @@ def get_call_data(usernames: List) -> pd.DataFrame: def enumerate_contacts(comm_df: pd.DataFrame) -> pd.DataFrame: - """" Count contacts (callers, senders) and enumerate them by their frequency. """ + """ + Count contacts (callers, senders) and enumerate them by their frequency. + + Parameters + ---------- + comm_df: pd.DataFrame + A dataframe of calls or SMSes. + + Returns + ------- + comm_df: pd.DataFrame + The altered dataframe with the column contact_id, arranged by frequency. + """ contact_counts = ( comm_df["trace"] .value_counts(sort=True, ascending=False)