Skip to content
Advertisement

module ‘networkx’ has no attribute ‘from_pandas_edgelist’

here is my code:

employee_movie_choices = pd.read_csv('Employee_Movie_Choices.txt', sep="t")
B = nx.from_pandas_edgelist(employee_movie_choices, '#Employee', 'Movie')

and there is an error:AttributeError: module ‘networkx’ has no attribute ‘from_pandas_edgelist’* however, this the documents of networx we could find networkx has the attribute. here is the link of the documents:from_pandas_edgelist

why did this question happen?

Advertisement

Answer

Are you defining the alias nx as follows:

import networkx as nx

If yes, try calling the required function as follows:

import networkx as nx 
......
......
nx.convert_matrix.from_pandas_edgelist(...)
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement