Add a plot of most frequent contacts.
parent
9301d9ec7f
commit
f37e8dc0eb
File diff suppressed because one or more lines are too long
|
@ -86,8 +86,8 @@ def enumerate_contacts(comm_df: pd.DataFrame) -> pd.DataFrame:
|
||||||
# In other words, recode the contacts into integers from 0 to n_contacts,
|
# In other words, recode the contacts into integers from 0 to n_contacts,
|
||||||
# so that the first one is contacted the most often.
|
# so that the first one is contacted the most often.
|
||||||
contact_ids = (
|
contact_ids = (
|
||||||
contact_counts.groupby("participant_id") # Group again for enummeration.
|
contact_counts.groupby("participant_id") # Group again for enumeration.
|
||||||
.cumcount() # Enummerate (count) rows *within* participants.
|
.cumcount() # Enumerate (count) rows *within* participants.
|
||||||
.to_frame("contact_id")
|
.to_frame("contact_id")
|
||||||
)
|
)
|
||||||
contact_counts = contact_counts.join(contact_ids)
|
contact_counts = contact_counts.join(contact_ids)
|
||||||
|
|
Loading…
Reference in New Issue