Created
May 25, 2022 15:55
-
-
Save tomasonjo/8190c2d92ad4a1570a780442f3ad1c93 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
# 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