Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Get component sizes
graph_features = graph_features.merge(
graph_features.groupby('componentId').size().to_frame('componentSize').reset_index(), on="componentId")
# Define a feature which indicates if the component has more than 1 member
graph_features['part_of_community'] = (graph_features['componentSize'] > 1).astype(int)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment