AttributeError: module 'networkx' has no attribute 'from_pandas_dataframe'

前端 未结 3 339
名媛妹妹
名媛妹妹 2021-01-07 16:40

I have networkx v. 2.1. to make it work w/ pandas dataframe, i tried following:

  • installed via pip3, this did not work generated
3条回答
  •  鱼传尺愫
    2021-01-07 16:59

    This solution helps as well:

    G = nx.DiGraph()
    G.add_weighted_edges_from([tuple(x) for x in x.values])
    nx.info(G)
    
    
    'Name: \nType: DiGraph\nNumber of nodes: 5713\nNumber of edges: 5000\nAverage in degree:   0.8752\nAverage out degree:   0.8752'
    

提交回复
热议问题