Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khuyentran1401/0d19253ff41bf68addf933a74e40ad13 to your computer and use it in GitHub Desktop.
Save khuyentran1401/0d19253ff41bf68addf933a74e40ad13 to your computer and use it in GitHub Desktop.
import numpy as np
def get_average_friends_of_a_person_friends(data: pd.DataFrame, person_id):
"""Get the average number of friends a person's friends have"""
num_friends_map = get_num_friends_map(friends)
num_friends_of_friends = get_num_friends_of_a_person_friends(
data, person_id, num_friends_map
)
return np.mean(num_friends_of_friends)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment