简体   繁体   中英

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

A is co occurrence dataframe. Why it shown AttributeError: module .networkx' has no attribute 'from_numpy_matrix'

import numpy as np
import networkx as nx
import matplotlib
A=np.matrix(coocc)
G=nx.from_numpy_matrix(A)

In.networkx 3.0 the changelog shows the following "Remove to_numpy_matrix & from_numpy_matrix (#5746)" https:/.networkx.org/documentation/stable/release/release_3.0.html

You have to downgrade.networkx or use G=nx.from_numpy_array(A) instead. https:/.networkx.org/documentation/stable/reference/readwrite/matrix_market.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM