I want to be able to export a graph made by OSMnx (in other words, NetworkX graph) into CSV and to call it back later. Couldn't find any good way to do that so I try to export it into Numpy / Pandas and to export that. So I built this little example:
import networkx as nx
import osmnx as ox
G = ox.graph_from_place('Bar Ilan University, Israel')
F = nx.to_numpy_matrix(G)
G = nx.from_numpy_matrix(F, create_using=nx.MultiDiGraph)
ox.plot.plot_graph(G)
and it returns this error and nothing seems to help:
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) in 4 F = nx.to_numpy_matrix(G) 5 G = nx.from_numpy_matrix(F, create_using=nx.MultiDiGraph) ----> 6 ox.plot.plot_graph(G)
~\Anaconda3\envs\ox\lib\site-packages\osmnx\plot.py in plot_graph(G, bbox, fig_height, fig_width, margin, axis_off, equal_aspect, bgcolor, show, save, close, file_format, filename, dpi, annotate, node_color, node_size, node_alpha, node_edgecolor, node_zorder, edge_color, edge_linewidth, edge_alpha, use_geom) 353 354 log('Begin plotting the graph...') --> 355 node_Xs = [float(x) for _, x in G.nodes(data='x')] 356 node_Ys = [float(y) for _, y in G.nodes(data='y')] 357
~\Anaconda3\envs\ox\lib\site-packages\osmnx\plot.py in (.0) 353 354 log('Begin plotting the graph...') --> 355 node_Xs = [float(x) for _, x in G.nodes(data='x')] 356 node_Ys = [float(y) for _, y in G.nodes(data='y')] 357
TypeError: float() argument must be a string or a number, not 'NoneType'
- What can I do?
- Is there is any simple method that I'm missing?