'I need to plot the graphs using networkx . How can we do that without using groupby as it converts the data to panda series
I have data in a CSV file. Which contains data of all students and registered courses. After reading the data I selected 2 columns i.e ID and course_title. I need to plot a graph for each class where nodes are student IDs and each node should be connected to every other node in the class. So I need to pair students in a class for that I have written below code but it didn't work. Can you please correct me where am I doing wrong?
df_node = cs_class_df[['ID','COURSE']]
df_node = df_node.groupby(["COURSE"])
group_classes = df_node["ID"].apply(list)
group_classes = group_classes.reset_index()
print(group_classes)
group_classes= group_classes.loc[4:4]
print(group_classes)
df_list = group_classes["ID"]
df_list actually contains [1,4,5,8] df_list has become a series so even If I convert this to array its length is 1. I need to pair the elements in df_list like [(1,4),(1,5),(1,8),(4,5),(4,8),(5,8)]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
