start_time = time.time()
// create a GeoDataFrame of the nodes, name it, convert osmid to str
nodes_data = [data for _, data in G_proj.nodes(data=True)]
gdf_nodes = gpd.GeoDataFrame(nodes_data, index=G_proj.nodes(data=False))
gdf_nodes.crs = G_proj.graph["crs"]
gdf_nodes.gdf_name = "{}_nodes".format(G_proj.name)
// create new lat/lon columns just to save that data for later, and create a
// geometry column from x/y
gdf_nodes["lon"] = gdf_nodes["x"]
gdf_nodes["lat"] = gdf_nodes["y"]
gdf_nodes["geometry"] = gdf_nodes.apply(lambda row: Point(row["x"], row["y"]), axis=1)
log("Created a GeoDataFrame from graph in {:,.2f} seconds".format(time.time()-start_time))
After Change
start_time = time.time()
// create a GeoDataFrame of the nodes, name it, convert osmid to str
node_data = [list(i) for i in zip(*G_proj.nodes(data=True))]
gdf_nodes = gpd.GeoDataFrame(node_data[1], index=node_data[0])
gdf_nodes.crs = G_proj.graph["crs"]
gdf_nodes.gdf_name = "{}_nodes".format(G_proj.name)
// create new lat/lon columns just to save that data for later, and create a
// geometry column from x/y
gdf_nodes["lon"] = gdf_nodes["x"]
gdf_nodes["lat"] = gdf_nodes["y"]
gdf_nodes["geometry"] = gdf_nodes.apply(lambda row: Point(row["x"], row["y"]), axis=1)
log("Created a GeoDataFrame from graph in {:,.2f} seconds".format(time.time()-start_time))