Created
August 26, 2021 20:54
-
-
Save khuyentran1401/51e2f4d2ed0b990924a8063f01101025 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_friends(data: pd.DataFrame, person_id): | |
"""Get friends of a person with specified id""" | |
return ( | |
data[data["person1"] == person_id]["person2"].values.tolist() | |
+ data[data["person2"] == person_id]["person1"].values.tolist() | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment