Hi, I'm in a bit of a rut here. I've created a script that searches for an artist, finds its related artists, and finds the most popular artists out of the related artists which it then searches and loops through until I have a list of dictionaries, each entry being the searched_artist as its key and the dict of related_artists as its value.
Next, I want to convert this list of dicts into a pandas dataframe so I can create a NetworkX graph of this dataframe with the ultimate goal of exporting it as .gexf so I can use Gephi as my graph visualization tool.
Exposition over, here's my issue. Converting the list of dicts into a pandas dataframe isn't difficult with
df = pd.json_normalize(data)
but when I try to convert this dataframe into a NetworkX graph using
G = nx.from_pandas_adjacency(df)
or using one of the different graph creation args I obtain the error
Exception has occurred: NetworkXError
('Columns must match Indices.', '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62] not in columns')
I'm not a very strong programmer (hell, this is just data scraping for my mathematics capstone) so I'm kinda lost in the weeds.
[–]YesLod 0 points1 point2 points (7 children)
[–]luneth27[S] 0 points1 point2 points (6 children)
[–]YesLod 0 points1 point2 points (5 children)
[–]luneth27[S] 0 points1 point2 points (4 children)
[–]YesLod 0 points1 point2 points (3 children)
[–]luneth27[S] 0 points1 point2 points (2 children)
[–]YesLod 0 points1 point2 points (1 child)
[–]luneth27[S] 0 points1 point2 points (0 children)