Mean average shortest path lengths networkx and osmnx

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
0
down vote

favorite












I am working on a project to find a contaminated water well that killed 250 people. There are seven water wells in an area.



I would like to compute shortest path lengths from each well to all deaths and calculate mean average of lengths. The well that has smallest mean average would be a candidate as a source of contamination.



Using NetworkX and Osmnx, I was able to create shortest path lengths from each well to 250 deaths. Then, I calculated mean average. I have seven mean average shortest path lengths. The code is repetition of calculation of shortest path lengths from one well to each death 250 times. I was wondering if there is a way to automate it.



import statistics
import networkx as nx
import osmnx as ox
import pandas as pd

ox.config(use_cache=True, log_console=True)
ox.__version__
ox.config(log_file=True, log_console=True, use_cache=True)

# CSV with 250 deaths locations in Latitude and Longitude
destinations = pd.read_csv('resources/destinations.csv')

# CSV with well locations in Latitude and Longitude
origins = pd.read_csv('resources/origins.csv')

# Get graph for a location
COORDINATES = (51.513578, -0.136722)
G = ox.graph_from_point(COORDINATES, network_type='walk')
fig, ax = ox.plot_graph(G)

# Get node for origin 0
origin_node_0 = ox.get_nearest_node(G, origins.loc[0, ['LAT', 'LON']])

# Get nodes for each destination
# Get shortest path length from origin node 0 to destination node 0 through 249

origin_node_0 = ox.get_nearest_node(G, origins.loc[0, ['LAT', 'LON']])

destination_node_0 = ox.get_nearest_node(G, destinations.loc[0, ['LAT', 'LON']])
route = nx.shortest_path_length(G, origin_node_0, destination_node_0, weight='length')
destination_node_1 = ox.get_nearest_node(G, destinations.loc[1, ['LAT', 'LON']])
route1 = nx.shortest_path_length(G, origin_node_0, destination_node_1, weight='length')
destination_node_2 = ox.get_nearest_node(G, destinations.loc[2, ['LAT', 'LON']])
route2 = nx.shortest_path_length(G, origin_node_0, destination_node_2, weight='length')
destination_node_3 = ox.get_nearest_node(G, destinations.loc[3, ['LAT', 'LON']])
route3 = nx.shortest_path_length(G, origin_node_0, destination_node_3, weight='length')
destination_node_4 = ox.get_nearest_node(G, destinations.loc[4,['LAT', 'LON']])
route4 = nx.shortest_path_length(G, origin_node_0, destination_node_4, weight='length')
destination_node_5 = ox.get_nearest_node(G, destinations.loc[5,['LAT', 'LON']])
route5 = nx.shortest_path_length(G, origin_node_0, destination_node_5, weight='length')
destination_node_6 = ox.get_nearest_node(G, destinations.loc[6,['LAT', 'LON']])
route6 = nx.shortest_path_length(G, origin_node_0, destination_node_6, weight='length')
destination_node_7 = ox.get_nearest_node(G, destinations.loc[7,['LAT', 'LON']])
route7 = nx.shortest_path_length(G, origin_node_0, destination_node_7, weight='length')
destination_node_8 = ox.get_nearest_node(G, destinations.loc[8,['LAT', 'LON']])
route8 = nx.shortest_path_length(G, origin_node_0, destination_node_8, weight='length')
destination_node_9 = ox.get_nearest_node(G, destinations.loc[9,['LAT', 'LON']])
route9 = nx.shortest_path_length(G, origin_node_0, destination_node_9, weight='length')
destination_node_10 = ox.get_nearest_node(G, destinations.loc[10,['LAT', 'LON']])
route10 = nx.shortest_path_length(G, origin_node_0, destination_node_10, weight='length')
destination_node_11 = ox.get_nearest_node(G, destinations.loc[11,['LAT', 'LON']])
route11 = nx.shortest_path_length(G, origin_node_0, destination_node_11, weight='length')
destination_node_12 = ox.get_nearest_node(G, destinations.loc[12,['LAT', 'LON']])
route12 = nx.shortest_path_length(G, origin_node_0, destination_node_12, weight='length')
destination_node_13 = ox.get_nearest_node(G, destinations.loc[13,['LAT', 'LON']])
route13 = nx.shortest_path_length(G, origin_node_0, destination_node_13, weight='length')
destination_node_14 = ox.get_nearest_node(G, destinations.loc[14,['LAT', 'LON']])
route14 = nx.shortest_path_length(G, origin_node_0, destination_node_14, weight='length')
destination_node_15 = ox.get_nearest_node(G, destinations.loc[15,['LAT', 'LON']])
route15 = nx.shortest_path_length(G, origin_node_0, destination_node_15, weight='length')
destination_node_16 = ox.get_nearest_node(G, destinations.loc[16, ['LAT', 'LON']])
route16 = nx.shortest_path_length(G, origin_node_0, destination_node_16, weight='length')
destination_node_17 = ox.get_nearest_node(G, destinations.loc[17, ['LAT', 'LON']])
route17 = nx.shortest_path_length(G, origin_node_0, destination_node_17, weight='length')
destination_node_18 = ox.get_nearest_node(G, destinations.loc[18, ['LAT', 'LON']])
route18 = nx.shortest_path_length(G, origin_node_0, destination_node_18, weight='length')
destination_node_19 = ox.get_nearest_node(G, destinations.loc[19, ['LAT', 'LON']])
route19 = nx.shortest_path_length(G, origin_node_0, destination_node_19, weight='length')
destination_node_20 = ox.get_nearest_node(G, destinations.loc[20,['LAT', 'LON']])
route20 = nx.shortest_path_length(G, origin_node_0, destination_node_20, weight='length')
destination_node_21 = ox.get_nearest_node(G, destinations.loc[21,['LAT', 'LON']])
route21 = nx.shortest_path_length(G, origin_node_0, destination_node_21, weight='length')
destination_node_22 = ox.get_nearest_node(G, destinations.loc[22,['LAT', 'LON']])
route22 = nx.shortest_path_length(G, origin_node_0, destination_node_22, weight='length')
destination_node_23 = ox.get_nearest_node(G, destinations.loc[23,['LAT', 'LON']])
route23 = nx.shortest_path_length(G, origin_node_0, destination_node_23, weight='length')
destination_node_24 = ox.get_nearest_node(G, destinations.loc[24,['LAT', 'LON']])
route24 = nx.shortest_path_length(G, origin_node_0, destination_node_24, weight='length')
destination_node_25 = ox.get_nearest_node(G, destinations.loc[25,['LAT', 'LON']])
route25 = nx.shortest_path_length(G, origin_node_0, destination_node_25, weight='length')
destination_node_26 = ox.get_nearest_node(G, destinations.loc[26,['LAT', 'LON']])
route26 = nx.shortest_path_length(G, origin_node_0, destination_node_26, weight='length')
destination_node_27 = ox.get_nearest_node(G, destinations.loc[27,['LAT', 'LON']])
route27 = nx.shortest_path_length(G, origin_node_0, destination_node_27, weight='length')
destination_node_28 = ox.get_nearest_node(G, destinations.loc[28,['LAT', 'LON']])
route28 = nx.shortest_path_length(G, origin_node_0, destination_node_28, weight='length')
destination_node_29 = ox.get_nearest_node(G, destinations.loc[29,['LAT', 'LON']])
route29 = nx.shortest_path_length(G, origin_node_0, destination_node_29, weight='length')
destination_node_30 = ox.get_nearest_node(G, destinations.loc[30,['LAT', 'LON']])
route30 = nx.shortest_path_length(G, origin_node_0, destination_node_30, weight='length')
destination_node_31 = ox.get_nearest_node(G, destinations.loc[31, ['LAT', 'LON']])
route31 = nx.shortest_path_length(G, origin_node_0, destination_node_31, weight='length')
destination_node_32 = ox.get_nearest_node(G, destinations.loc[32, ['LAT', 'LON']])
route32 = nx.shortest_path_length(G, origin_node_0, destination_node_32, weight='length')
destination_node_33 = ox.get_nearest_node(G, destinations.loc[33, ['LAT', 'LON']])
route33 = nx.shortest_path_length(G, origin_node_0, destination_node_33, weight='length')
destination_node_34 = ox.get_nearest_node(G, destinations.loc[34,['LAT', 'LON']])
route34 = nx.shortest_path_length(G, origin_node_0, destination_node_34, weight='length')
destination_node_35 = ox.get_nearest_node(G, destinations.loc[35,['LAT', 'LON']])
route35 = nx.shortest_path_length(G, origin_node_0, destination_node_35, weight='length')
destination_node_36 = ox.get_nearest_node(G, destinations.loc[36,['LAT', 'LON']])
route36 = nx.shortest_path_length(G, origin_node_0, destination_node_36, weight='length')
destination_node_37 = ox.get_nearest_node(G, destinations.loc[37,['LAT', 'LON']])
route37 = nx.shortest_path_length(G, origin_node_0, destination_node_37, weight='length')
destination_node_38 = ox.get_nearest_node(G, destinations.loc[38,['LAT', 'LON']])
route38 = nx.shortest_path_length(G, origin_node_0, destination_node_38, weight='length')
destination_node_39 = ox.get_nearest_node(G, destinations.loc[39,['LAT', 'LON']])
route39 = nx.shortest_path_length(G, origin_node_0, destination_node_39, weight='length')
destination_node_40 = ox.get_nearest_node(G, destinations.loc[40,['LAT', 'LON']])
route40 = nx.shortest_path_length(G, origin_node_0, destination_node_40, weight='length')
destination_node_41 = ox.get_nearest_node(G, destinations.loc[41,['LAT', 'LON']])
route41 = nx.shortest_path_length(G, origin_node_0, destination_node_41, weight='length')
destination_node_42 = ox.get_nearest_node(G, destinations.loc[42,['LAT', 'LON']])
route42 = nx.shortest_path_length(G, origin_node_0, destination_node_42, weight='length')
destination_node_43 = ox.get_nearest_node(G, destinations.loc[43,['LAT', 'LON']])
route43 = nx.shortest_path_length(G, origin_node_0, destination_node_43, weight='length')
destination_node_44 = ox.get_nearest_node(G, destinations.loc[44,['LAT', 'LON']])
route44 = nx.shortest_path_length(G, origin_node_0, destination_node_44, weight='length')
destination_node_45 = ox.get_nearest_node(G, destinations.loc[45,['LAT', 'LON']])
route45 = nx.shortest_path_length(G, origin_node_0, destination_node_45, weight='length')
destination_node_46 = ox.get_nearest_node(G, destinations.loc[46, ['LAT', 'LON']])
route46 = nx.shortest_path_length(G, origin_node_0, destination_node_46, weight='length')
destination_node_47 = ox.get_nearest_node(G, destinations.loc[47, ['LAT', 'LON']])
route47 = nx.shortest_path_length(G, origin_node_0, destination_node_47, weight='length')
destination_node_48 = ox.get_nearest_node(G, destinations.loc[48, ['LAT', 'LON']])
route48 = nx.shortest_path_length(G, origin_node_0, destination_node_48, weight='length')
destination_node_49 = ox.get_nearest_node(G, destinations.loc[49, ['LAT', 'LON']])
route49 = nx.shortest_path_length(G, origin_node_0, destination_node_49, weight='length')
destination_node_50 = ox.get_nearest_node(G, destinations.loc[50, ['LAT', 'LON']])
route50 = nx.shortest_path_length(G, origin_node_0, destination_node_50, weight='length')
destination_node_51 = ox.get_nearest_node(G, destinations.loc[51, ['LAT', 'LON']])
route51 = nx.shortest_path_length(G, origin_node_0, destination_node_51, weight='length')
destination_node_52 = ox.get_nearest_node(G, destinations.loc[52, ['LAT', 'LON']])
route52 = nx.shortest_path_length(G, origin_node_0, destination_node_52, weight='length')
destination_node_53 = ox.get_nearest_node(G, destinations.loc[53, ['LAT', 'LON']])
route53 = nx.shortest_path_length(G, origin_node_0, destination_node_53, weight='length')
destination_node_54 = ox.get_nearest_node(G, destinations.loc[54,['LAT', 'LON']])
route54 = nx.shortest_path_length(G, origin_node_0, destination_node_54, weight='length')
destination_node_55 = ox.get_nearest_node(G, destinations.loc[55,['LAT', 'LON']])
route55 = nx.shortest_path_length(G, origin_node_0, destination_node_55, weight='length')
destination_node_56 = ox.get_nearest_node(G, destinations.loc[56,['LAT', 'LON']])
route56 = nx.shortest_path_length(G, origin_node_0, destination_node_56, weight='length')
destination_node_57 = ox.get_nearest_node(G, destinations.loc[57,['LAT', 'LON']])
route57 = nx.shortest_path_length(G, origin_node_0, destination_node_57, weight='length')
destination_node_58 = ox.get_nearest_node(G, destinations.loc[58,['LAT', 'LON']])
route58 = nx.shortest_path_length(G, origin_node_0, destination_node_58, weight='length')
destination_node_59 = ox.get_nearest_node(G, destinations.loc[59,['LAT', 'LON']])
route59 = nx.shortest_path_length(G, origin_node_0, destination_node_59, weight='length')
destination_node_60 = ox.get_nearest_node(G, destinations.loc[60,['LAT', 'LON']])
route60 = nx.shortest_path_length(G, origin_node_0, destination_node_60, weight='length')
destination_node_61 = ox.get_nearest_node(G, destinations.loc[61,['LAT', 'LON']])
route61 = nx.shortest_path_length(G, origin_node_0, destination_node_61, weight='length')
destination_node_62 = ox.get_nearest_node(G, destinations.loc[62,['LAT', 'LON']])
route62 = nx.shortest_path_length(G, origin_node_0, destination_node_62, weight='length')
destination_node_63 = ox.get_nearest_node(G, destinations.loc[63,['LAT', 'LON']])
route63 = nx.shortest_path_length(G, origin_node_0, destination_node_63, weight='length')
destination_node_64 = ox.get_nearest_node(G, destinations.loc[64,['LAT', 'LON']])
route64 = nx.shortest_path_length(G, origin_node_0, destination_node_64, weight='length')
destination_node_65 = ox.get_nearest_node(G, destinations.loc[65,['LAT', 'LON']])
route65 = nx.shortest_path_length(G, origin_node_0, destination_node_65, weight='length')
destination_node_66 = ox.get_nearest_node(G, destinations.loc[66, ['LAT', 'LON']])
route66 = nx.shortest_path_length(G, origin_node_0, destination_node_66, weight='length')
destination_node_67 = ox.get_nearest_node(G, destinations.loc[67, ['LAT', 'LON']])
route67 = nx.shortest_path_length(G, origin_node_0, destination_node_67, weight='length')
destination_node_68 = ox.get_nearest_node(G, destinations.loc[68, ['LAT', 'LON']])
route68 = nx.shortest_path_length(G, origin_node_0, destination_node_68, weight='length')
destination_node_69 = ox.get_nearest_node(G, destinations.loc[69, ['LAT', 'LON']])
route69 = nx.shortest_path_length(G, origin_node_0, destination_node_69, weight='length')
destination_node_70 = ox.get_nearest_node(G, destinations.loc[70,['LAT', 'LON']])
route70 = nx.shortest_path_length(G, origin_node_0, destination_node_70, weight='length')
destination_node_71 = ox.get_nearest_node(G, destinations.loc[71,['LAT', 'LON']])
route71 = nx.shortest_path_length(G, origin_node_0, destination_node_71, weight='length')
destination_node_72 = ox.get_nearest_node(G, destinations.loc[72,['LAT', 'LON']])
route72 = nx.shortest_path_length(G, origin_node_0, destination_node_72, weight='length')
destination_node_73 = ox.get_nearest_node(G, destinations.loc[73,['LAT', 'LON']])
route73 = nx.shortest_path_length(G, origin_node_0, destination_node_73, weight='length')
destination_node_74 = ox.get_nearest_node(G, destinations.loc[74,['LAT', 'LON']])
route74 = nx.shortest_path_length(G, origin_node_0, destination_node_74, weight='length')
destination_node_75 = ox.get_nearest_node(G, destinations.loc[75,['LAT', 'LON']])
route75 = nx.shortest_path_length(G, origin_node_0, destination_node_75, weight='length')
destination_node_76 = ox.get_nearest_node(G, destinations.loc[76,['LAT', 'LON']])
route76 = nx.shortest_path_length(G, origin_node_0, destination_node_76, weight='length')
destination_node_77 = ox.get_nearest_node(G, destinations.loc[77,['LAT', 'LON']])
route77 = nx.shortest_path_length(G, origin_node_0, destination_node_77, weight='length')
destination_node_78 = ox.get_nearest_node(G, destinations.loc[78,['LAT', 'LON']])
route78 = nx.shortest_path_length(G, origin_node_0, destination_node_78, weight='length')
destination_node_79 = ox.get_nearest_node(G, destinations.loc[79,['LAT', 'LON']])
route79 = nx.shortest_path_length(G, origin_node_0, destination_node_79, weight='length')
destination_node_80 = ox.get_nearest_node(G, destinations.loc[80,['LAT', 'LON']])
route80 = nx.shortest_path_length(G, origin_node_0, destination_node_80, weight='length')
destination_node_81 = ox.get_nearest_node(G, destinations.loc[81, ['LAT', 'LON']])
route81 = nx.shortest_path_length(G, origin_node_0, destination_node_81, weight='length')
destination_node_82 = ox.get_nearest_node(G, destinations.loc[82, ['LAT', 'LON']])
route82 = nx.shortest_path_length(G, origin_node_0, destination_node_82, weight='length')
destination_node_83 = ox.get_nearest_node(G, destinations.loc[83, ['LAT', 'LON']])
route83 = nx.shortest_path_length(G, origin_node_0, destination_node_83, weight='length')
destination_node_84 = ox.get_nearest_node(G, destinations.loc[84,['LAT', 'LON']])
route84 = nx.shortest_path_length(G, origin_node_0, destination_node_84, weight='length')
destination_node_85 = ox.get_nearest_node(G, destinations.loc[85,['LAT', 'LON']])
route85 = nx.shortest_path_length(G, origin_node_0, destination_node_85, weight='length')
destination_node_86 = ox.get_nearest_node(G, destinations.loc[86,['LAT', 'LON']])
route86 = nx.shortest_path_length(G, origin_node_0, destination_node_86, weight='length')
destination_node_87 = ox.get_nearest_node(G, destinations.loc[87,['LAT', 'LON']])
route87 = nx.shortest_path_length(G, origin_node_0, destination_node_87, weight='length')
destination_node_88 = ox.get_nearest_node(G, destinations.loc[88,['LAT', 'LON']])
route88 = nx.shortest_path_length(G, origin_node_0, destination_node_88, weight='length')
destination_node_89 = ox.get_nearest_node(G, destinations.loc[89,['LAT', 'LON']])
route89 = nx.shortest_path_length(G, origin_node_0, destination_node_89, weight='length')
destination_node_90 = ox.get_nearest_node(G, destinations.loc[90,['LAT', 'LON']])
route90 = nx.shortest_path_length(G, origin_node_0, destination_node_90, weight='length')
destination_node_91 = ox.get_nearest_node(G, destinations.loc[91,['LAT', 'LON']])
route91 = nx.shortest_path_length(G, origin_node_0, destination_node_91, weight='length')
destination_node_92 = ox.get_nearest_node(G, destinations.loc[92,['LAT', 'LON']])
route92 = nx.shortest_path_length(G, origin_node_0, destination_node_92, weight='length')
destination_node_93 = ox.get_nearest_node(G, destinations.loc[93,['LAT', 'LON']])
route93 = nx.shortest_path_length(G, origin_node_0, destination_node_93, weight='length')
destination_node_94 = ox.get_nearest_node(G, destinations.loc[94,['LAT', 'LON']])
route94 = nx.shortest_path_length(G, origin_node_0, destination_node_94, weight='length')
destination_node_95 = ox.get_nearest_node(G, destinations.loc[95,['LAT', 'LON']])
route95 = nx.shortest_path_length(G, origin_node_0, destination_node_95, weight='length')
destination_node_96 = ox.get_nearest_node(G, destinations.loc[96, ['LAT', 'LON']])
route96 = nx.shortest_path_length(G, origin_node_0, destination_node_96, weight='length')
destination_node_97 = ox.get_nearest_node(G, destinations.loc[97, ['LAT', 'LON']])
route97 = nx.shortest_path_length(G, origin_node_0, destination_node_97, weight='length')
destination_node_98 = ox.get_nearest_node(G, destinations.loc[98, ['LAT', 'LON']])
route98 = nx.shortest_path_length(G, origin_node_0, destination_node_98, weight='length')
destination_node_99 = ox.get_nearest_node(G, destinations.loc[99, ['LAT', 'LON']])
route99 = nx.shortest_path_length(G, origin_node_0, destination_node_99, weight='length')
destination_node_100 = ox.get_nearest_node(G, destinations.loc[100, ['LAT', 'LON']])
route100 = nx.shortest_path_length(G, origin_node_0, destination_node_100, weight='length')
destination_node_101 = ox.get_nearest_node(G, destinations.loc[101, ['LAT', 'LON']])
route101 = nx.shortest_path_length(G, origin_node_0, destination_node_101, weight='length')
destination_node_102 = ox.get_nearest_node(G, destinations.loc[102, ['LAT', 'LON']])
route102 = nx.shortest_path_length(G, origin_node_0, destination_node_102, weight='length')
destination_node_103 = ox.get_nearest_node(G, destinations.loc[103, ['LAT', 'LON']])
route103 = nx.shortest_path_length(G, origin_node_0, destination_node_103, weight='length')
destination_node_104 = ox.get_nearest_node(G, destinations.loc[104,['LAT', 'LON']])
route104 = nx.shortest_path_length(G, origin_node_0, destination_node_104, weight='length')
destination_node_105 = ox.get_nearest_node(G, destinations.loc[105,['LAT', 'LON']])
route105 = nx.shortest_path_length(G, origin_node_0, destination_node_105, weight='length')
destination_node_106 = ox.get_nearest_node(G, destinations.loc[106,['LAT', 'LON']])
route106 = nx.shortest_path_length(G, origin_node_0, destination_node_106, weight='length')
destination_node_107 = ox.get_nearest_node(G, destinations.loc[107,['LAT', 'LON']])
route107 = nx.shortest_path_length(G, origin_node_0, destination_node_107, weight='length')
destination_node_108 = ox.get_nearest_node(G, destinations.loc[108,['LAT', 'LON']])
route108 = nx.shortest_path_length(G, origin_node_0, destination_node_108, weight='length')
destination_node_109 = ox.get_nearest_node(G, destinations.loc[109,['LAT', 'LON']])
route109 = nx.shortest_path_length(G, origin_node_0, destination_node_109, weight='length')
destination_node_110 = ox.get_nearest_node(G, destinations.loc[110,['LAT', 'LON']])
route110 = nx.shortest_path_length(G, origin_node_0, destination_node_110, weight='length')
destination_node_111 = ox.get_nearest_node(G, destinations.loc[111,['LAT', 'LON']])
route111 = nx.shortest_path_length(G, origin_node_0, destination_node_111, weight='length')
destination_node_112 = ox.get_nearest_node(G, destinations.loc[112,['LAT', 'LON']])
route112 = nx.shortest_path_length(G, origin_node_0, destination_node_112, weight='length')
destination_node_113 = ox.get_nearest_node(G, destinations.loc[113,['LAT', 'LON']])
route113 = nx.shortest_path_length(G, origin_node_0, destination_node_113, weight='length')
destination_node_114 = ox.get_nearest_node(G, destinations.loc[114,['LAT', 'LON']])
route114 = nx.shortest_path_length(G, origin_node_0, destination_node_114, weight='length')
destination_node_115 = ox.get_nearest_node(G, destinations.loc[115,['LAT', 'LON']])
route115 = nx.shortest_path_length(G, origin_node_0, destination_node_115, weight='length')
destination_node_116 = ox.get_nearest_node(G, destinations.loc[116, ['LAT', 'LON']])
route116 = nx.shortest_path_length(G, origin_node_0, destination_node_116, weight='length')
destination_node_117 = ox.get_nearest_node(G, destinations.loc[117, ['LAT', 'LON']])
route117 = nx.shortest_path_length(G, origin_node_0, destination_node_117, weight='length')
destination_node_118 = ox.get_nearest_node(G, destinations.loc[118, ['LAT', 'LON']])
route118 = nx.shortest_path_length(G, origin_node_0, destination_node_118, weight='length')
destination_node_119 = ox.get_nearest_node(G, destinations.loc[119, ['LAT', 'LON']])
route119 = nx.shortest_path_length(G, origin_node_0, destination_node_119, weight='length')
destination_node_120 = ox.get_nearest_node(G, destinations.loc[120,['LAT', 'LON']])
route120 = nx.shortest_path_length(G, origin_node_0, destination_node_120, weight='length')
destination_node_121 = ox.get_nearest_node(G, destinations.loc[121,['LAT', 'LON']])
route121 = nx.shortest_path_length(G, origin_node_0, destination_node_121, weight='length')
destination_node_122 = ox.get_nearest_node(G, destinations.loc[122,['LAT', 'LON']])
route122 = nx.shortest_path_length(G, origin_node_0, destination_node_122, weight='length')
destination_node_123 = ox.get_nearest_node(G, destinations.loc[123,['LAT', 'LON']])
route123 = nx.shortest_path_length(G, origin_node_0, destination_node_123, weight='length')
destination_node_124 = ox.get_nearest_node(G, destinations.loc[124,['LAT', 'LON']])
route124 = nx.shortest_path_length(G, origin_node_0, destination_node_124, weight='length')
destination_node_125 = ox.get_nearest_node(G, destinations.loc[125,['LAT', 'LON']])
route125 = nx.shortest_path_length(G, origin_node_0, destination_node_125, weight='length')
destination_node_126 = ox.get_nearest_node(G, destinations.loc[126,['LAT', 'LON']])
route126 = nx.shortest_path_length(G, origin_node_0, destination_node_126, weight='length')
destination_node_127 = ox.get_nearest_node(G, destinations.loc[127,['LAT', 'LON']])
route127 = nx.shortest_path_length(G, origin_node_0, destination_node_127, weight='length')
destination_node_128 = ox.get_nearest_node(G, destinations.loc[128,['LAT', 'LON']])
route128 = nx.shortest_path_length(G, origin_node_0, destination_node_128, weight='length')
destination_node_129 = ox.get_nearest_node(G, destinations.loc[129,['LAT', 'LON']])
route129 = nx.shortest_path_length(G, origin_node_0, destination_node_129, weight='length')
destination_node_130 = ox.get_nearest_node(G, destinations.loc[130,['LAT', 'LON']])
route130 = nx.shortest_path_length(G, origin_node_0, destination_node_130, weight='length')
destination_node_131 = ox.get_nearest_node(G, destinations.loc[131, ['LAT', 'LON']])
route131 = nx.shortest_path_length(G, origin_node_0, destination_node_131, weight='length')
destination_node_132 = ox.get_nearest_node(G, destinations.loc[132, ['LAT', 'LON']])
route132 = nx.shortest_path_length(G, origin_node_0, destination_node_132, weight='length')
destination_node_133 = ox.get_nearest_node(G, destinations.loc[133, ['LAT', 'LON']])
route133 = nx.shortest_path_length(G, origin_node_0, destination_node_133, weight='length')
destination_node_134 = ox.get_nearest_node(G, destinations.loc[134,['LAT', 'LON']])
route134 = nx.shortest_path_length(G, origin_node_0, destination_node_134, weight='length')
destination_node_135 = ox.get_nearest_node(G, destinations.loc[135,['LAT', 'LON']])
route135 = nx.shortest_path_length(G, origin_node_0, destination_node_135, weight='length')
destination_node_136 = ox.get_nearest_node(G, destinations.loc[136,['LAT', 'LON']])
route136 = nx.shortest_path_length(G, origin_node_0, destination_node_136, weight='length')
destination_node_137 = ox.get_nearest_node(G, destinations.loc[137,['LAT', 'LON']])
route137 = nx.shortest_path_length(G, origin_node_0, destination_node_137, weight='length')
destination_node_138 = ox.get_nearest_node(G, destinations.loc[138,['LAT', 'LON']])
route138 = nx.shortest_path_length(G, origin_node_0, destination_node_138, weight='length')
destination_node_139 = ox.get_nearest_node(G, destinations.loc[139,['LAT', 'LON']])
route139 = nx.shortest_path_length(G, origin_node_0, destination_node_139, weight='length')
destination_node_140 = ox.get_nearest_node(G, destinations.loc[140,['LAT', 'LON']])
route140 = nx.shortest_path_length(G, origin_node_0, destination_node_140, weight='length')
destination_node_141 = ox.get_nearest_node(G, destinations.loc[141,['LAT', 'LON']])
route141 = nx.shortest_path_length(G, origin_node_0, destination_node_141, weight='length')
destination_node_142 = ox.get_nearest_node(G, destinations.loc[142,['LAT', 'LON']])
route142 = nx.shortest_path_length(G, origin_node_0, destination_node_142, weight='length')
destination_node_143 = ox.get_nearest_node(G, destinations.loc[143,['LAT', 'LON']])
route143 = nx.shortest_path_length(G, origin_node_0, destination_node_143, weight='length')
destination_node_144 = ox.get_nearest_node(G, destinations.loc[144,['LAT', 'LON']])
route144 = nx.shortest_path_length(G, origin_node_0, destination_node_144, weight='length')
destination_node_145 = ox.get_nearest_node(G, destinations.loc[145,['LAT', 'LON']])
route145 = nx.shortest_path_length(G, origin_node_0, destination_node_145, weight='length')
destination_node_146 = ox.get_nearest_node(G, destinations.loc[146, ['LAT', 'LON']])
route146 = nx.shortest_path_length(G, origin_node_0, destination_node_146, weight='length')
destination_node_147 = ox.get_nearest_node(G, destinations.loc[147, ['LAT', 'LON']])
route147 = nx.shortest_path_length(G, origin_node_0, destination_node_147, weight='length')
destination_node_148 = ox.get_nearest_node(G, destinations.loc[148, ['LAT', 'LON']])
route148 = nx.shortest_path_length(G, origin_node_0, destination_node_148, weight='length')
destination_node_149 = ox.get_nearest_node(G, destinations.loc[149, ['LAT', 'LON']])
route149 = nx.shortest_path_length(G, origin_node_0, destination_node_149, weight='length')
destination_node_150 = ox.get_nearest_node(G, destinations.loc[150, ['LAT', 'LON']])
route150 = nx.shortest_path_length(G, origin_node_0, destination_node_150, weight='length')
destination_node_151 = ox.get_nearest_node(G, destinations.loc[151, ['LAT', 'LON']])
route151 = nx.shortest_path_length(G, origin_node_0, destination_node_151, weight='length')
destination_node_152 = ox.get_nearest_node(G, destinations.loc[152, ['LAT', 'LON']])
route152 = nx.shortest_path_length(G, origin_node_0, destination_node_152, weight='length')
destination_node_153 = ox.get_nearest_node(G, destinations.loc[153, ['LAT', 'LON']])
route153 = nx.shortest_path_length(G, origin_node_0, destination_node_153, weight='length')
destination_node_154 = ox.get_nearest_node(G, destinations.loc[154,['LAT', 'LON']])
route154 = nx.shortest_path_length(G, origin_node_0, destination_node_154, weight='length')
destination_node_155 = ox.get_nearest_node(G, destinations.loc[155,['LAT', 'LON']])
route155 = nx.shortest_path_length(G, origin_node_0, destination_node_155, weight='length')
destination_node_156 = ox.get_nearest_node(G, destinations.loc[156,['LAT', 'LON']])
route156 = nx.shortest_path_length(G, origin_node_0, destination_node_156, weight='length')
destination_node_157 = ox.get_nearest_node(G, destinations.loc[157,['LAT', 'LON']])
route157 = nx.shortest_path_length(G, origin_node_0, destination_node_157, weight='length')
destination_node_158 = ox.get_nearest_node(G, destinations.loc[158,['LAT', 'LON']])
route158 = nx.shortest_path_length(G, origin_node_0, destination_node_158, weight='length')
destination_node_159 = ox.get_nearest_node(G, destinations.loc[159,['LAT', 'LON']])
route159 = nx.shortest_path_length(G, origin_node_0, destination_node_159, weight='length')
destination_node_160 = ox.get_nearest_node(G, destinations.loc[160,['LAT', 'LON']])
route160 = nx.shortest_path_length(G, origin_node_0, destination_node_160, weight='length')
destination_node_161 = ox.get_nearest_node(G, destinations.loc[161,['LAT', 'LON']])
route161 = nx.shortest_path_length(G, origin_node_0, destination_node_161, weight='length')
destination_node_162 = ox.get_nearest_node(G, destinations.loc[162,['LAT', 'LON']])
route162 = nx.shortest_path_length(G, origin_node_0, destination_node_162, weight='length')
destination_node_163 = ox.get_nearest_node(G, destinations.loc[163,['LAT', 'LON']])
route163 = nx.shortest_path_length(G, origin_node_0, destination_node_163, weight='length')
destination_node_164 = ox.get_nearest_node(G, destinations.loc[164,['LAT', 'LON']])
route164 = nx.shortest_path_length(G, origin_node_0, destination_node_164, weight='length')
destination_node_165 = ox.get_nearest_node(G, destinations.loc[165,['LAT', 'LON']])
route165 = nx.shortest_path_length(G, origin_node_0, destination_node_165, weight='length')
destination_node_166 = ox.get_nearest_node(G, destinations.loc[166, ['LAT', 'LON']])
route166 = nx.shortest_path_length(G, origin_node_0, destination_node_166, weight='length')
destination_node_167 = ox.get_nearest_node(G, destinations.loc[167, ['LAT', 'LON']])
route167 = nx.shortest_path_length(G, origin_node_0, destination_node_167, weight='length')
destination_node_168 = ox.get_nearest_node(G, destinations.loc[168, ['LAT', 'LON']])
route168 = nx.shortest_path_length(G, origin_node_0, destination_node_168, weight='length')
destination_node_169 = ox.get_nearest_node(G, destinations.loc[169, ['LAT', 'LON']])
route169 = nx.shortest_path_length(G, origin_node_0, destination_node_169, weight='length')
destination_node_170 = ox.get_nearest_node(G, destinations.loc[170,['LAT', 'LON']])
route170 = nx.shortest_path_length(G, origin_node_0, destination_node_170, weight='length')
destination_node_171 = ox.get_nearest_node(G, destinations.loc[171,['LAT', 'LON']])
route171 = nx.shortest_path_length(G, origin_node_0, destination_node_171, weight='length')
destination_node_172 = ox.get_nearest_node(G, destinations.loc[172,['LAT', 'LON']])
route172 = nx.shortest_path_length(G, origin_node_0, destination_node_172, weight='length')
destination_node_173 = ox.get_nearest_node(G, destinations.loc[173,['LAT', 'LON']])
route173 = nx.shortest_path_length(G, origin_node_0, destination_node_173, weight='length')
destination_node_174 = ox.get_nearest_node(G, destinations.loc[174,['LAT', 'LON']])
route174 = nx.shortest_path_length(G, origin_node_0, destination_node_174, weight='length')
destination_node_175 = ox.get_nearest_node(G, destinations.loc[175,['LAT', 'LON']])
route175 = nx.shortest_path_length(G, origin_node_0, destination_node_175, weight='length')
destination_node_176 = ox.get_nearest_node(G, destinations.loc[176,['LAT', 'LON']])
route176 = nx.shortest_path_length(G, origin_node_0, destination_node_176, weight='length')
destination_node_177 = ox.get_nearest_node(G, destinations.loc[177,['LAT', 'LON']])
route177 = nx.shortest_path_length(G, origin_node_0, destination_node_177, weight='length')
destination_node_178 = ox.get_nearest_node(G, destinations.loc[178,['LAT', 'LON']])
route178 = nx.shortest_path_length(G, origin_node_0, destination_node_178, weight='length')
destination_node_179 = ox.get_nearest_node(G, destinations.loc[179,['LAT', 'LON']])
route179 = nx.shortest_path_length(G, origin_node_0, destination_node_179, weight='length')
destination_node_180 = ox.get_nearest_node(G, destinations.loc[180,['LAT', 'LON']])
route180 = nx.shortest_path_length(G, origin_node_0, destination_node_180, weight='length')
destination_node_181 = ox.get_nearest_node(G, destinations.loc[181, ['LAT', 'LON']])
route181 = nx.shortest_path_length(G, origin_node_0, destination_node_181, weight='length')
destination_node_182 = ox.get_nearest_node(G, destinations.loc[182, ['LAT', 'LON']])
route182 = nx.shortest_path_length(G, origin_node_0, destination_node_182, weight='length')
destination_node_183 = ox.get_nearest_node(G, destinations.loc[183, ['LAT', 'LON']])
route183 = nx.shortest_path_length(G, origin_node_0, destination_node_183, weight='length')
destination_node_184 = ox.get_nearest_node(G, destinations.loc[184,['LAT', 'LON']])
route184 = nx.shortest_path_length(G, origin_node_0, destination_node_184, weight='length')
destination_node_185 = ox.get_nearest_node(G, destinations.loc[185,['LAT', 'LON']])
route185 = nx.shortest_path_length(G, origin_node_0, destination_node_185, weight='length')
destination_node_186 = ox.get_nearest_node(G, destinations.loc[186,['LAT', 'LON']])
route186 = nx.shortest_path_length(G, origin_node_0, destination_node_186, weight='length')
destination_node_187 = ox.get_nearest_node(G, destinations.loc[187,['LAT', 'LON']])
route187 = nx.shortest_path_length(G, origin_node_0, destination_node_187, weight='length')
destination_node_188 = ox.get_nearest_node(G, destinations.loc[188,['LAT', 'LON']])
route188 = nx.shortest_path_length(G, origin_node_0, destination_node_188, weight='length')
destination_node_189 = ox.get_nearest_node(G, destinations.loc[189,['LAT', 'LON']])
route189 = nx.shortest_path_length(G, origin_node_0, destination_node_189, weight='length')
destination_node_190 = ox.get_nearest_node(G, destinations.loc[190,['LAT', 'LON']])
route190 = nx.shortest_path_length(G, origin_node_0, destination_node_190, weight='length')
destination_node_191 = ox.get_nearest_node(G, destinations.loc[191,['LAT', 'LON']])
route191 = nx.shortest_path_length(G, origin_node_0, destination_node_191, weight='length')
destination_node_192 = ox.get_nearest_node(G, destinations.loc[192,['LAT', 'LON']])
route192 = nx.shortest_path_length(G, origin_node_0, destination_node_192, weight='length')
destination_node_193 = ox.get_nearest_node(G, destinations.loc[193,['LAT', 'LON']])
route193 = nx.shortest_path_length(G, origin_node_0, destination_node_193, weight='length')
destination_node_194 = ox.get_nearest_node(G, destinations.loc[194,['LAT', 'LON']])
route194 = nx.shortest_path_length(G, origin_node_0, destination_node_194, weight='length')
destination_node_195 = ox.get_nearest_node(G, destinations.loc[195,['LAT', 'LON']])
route195 = nx.shortest_path_length(G, origin_node_0, destination_node_195, weight='length')
destination_node_196 = ox.get_nearest_node(G, destinations.loc[196, ['LAT', 'LON']])
route196 = nx.shortest_path_length(G, origin_node_0, destination_node_196, weight='length')
destination_node_197 = ox.get_nearest_node(G, destinations.loc[197, ['LAT', 'LON']])
route197 = nx.shortest_path_length(G, origin_node_0, destination_node_197, weight='length')
destination_node_198 = ox.get_nearest_node(G, destinations.loc[198, ['LAT', 'LON']])
route198 = nx.shortest_path_length(G, origin_node_0, destination_node_198, weight='length')
destination_node_199 = ox.get_nearest_node(G, destinations.loc[199, ['LAT', 'LON']])
route199 = nx.shortest_path_length(G, origin_node_0, destination_node_199, weight='length')
destination_node_200 = ox.get_nearest_node(G, destinations.loc[200, ['LAT', 'LON']])
route200 = nx.shortest_path_length(G, origin_node_0, destination_node_200, weight='length')
destination_node_201 = ox.get_nearest_node(G, destinations.loc[201, ['LAT', 'LON']])
route201 = nx.shortest_path_length(G, origin_node_0, destination_node_201, weight='length')
destination_node_202 = ox.get_nearest_node(G, destinations.loc[202, ['LAT', 'LON']])
route202 = nx.shortest_path_length(G, origin_node_0, destination_node_202, weight='length')
destination_node_203 = ox.get_nearest_node(G, destinations.loc[203, ['LAT', 'LON']])
route203 = nx.shortest_path_length(G, origin_node_0, destination_node_203, weight='length')
destination_node_204 = ox.get_nearest_node(G, destinations.loc[204,['LAT', 'LON']])
route204 = nx.shortest_path_length(G, origin_node_0, destination_node_204, weight='length')
destination_node_205 = ox.get_nearest_node(G, destinations.loc[205,['LAT', 'LON']])
route205 = nx.shortest_path_length(G, origin_node_0, destination_node_205, weight='length')
destination_node_206 = ox.get_nearest_node(G, destinations.loc[206,['LAT', 'LON']])
route206 = nx.shortest_path_length(G, origin_node_0, destination_node_206, weight='length')
destination_node_207 = ox.get_nearest_node(G, destinations.loc[207,['LAT', 'LON']])
route207 = nx.shortest_path_length(G, origin_node_0, destination_node_207, weight='length')
destination_node_208 = ox.get_nearest_node(G, destinations.loc[208,['LAT', 'LON']])
route208 = nx.shortest_path_length(G, origin_node_0, destination_node_208, weight='length')
destination_node_209 = ox.get_nearest_node(G, destinations.loc[209,['LAT', 'LON']])
route209 = nx.shortest_path_length(G, origin_node_0, destination_node_209, weight='length')
destination_node_210 = ox.get_nearest_node(G, destinations.loc[210,['LAT', 'LON']])
route210 = nx.shortest_path_length(G, origin_node_0, destination_node_210, weight='length')
destination_node_211 = ox.get_nearest_node(G, destinations.loc[211,['LAT', 'LON']])
route211 = nx.shortest_path_length(G, origin_node_0, destination_node_211, weight='length')
destination_node_212 = ox.get_nearest_node(G, destinations.loc[212,['LAT', 'LON']])
route212 = nx.shortest_path_length(G, origin_node_0, destination_node_212, weight='length')
destination_node_213 = ox.get_nearest_node(G, destinations.loc[213,['LAT', 'LON']])
route213 = nx.shortest_path_length(G, origin_node_0, destination_node_213, weight='length')
destination_node_214 = ox.get_nearest_node(G, destinations.loc[214,['LAT', 'LON']])
route214 = nx.shortest_path_length(G, origin_node_0, destination_node_214, weight='length')
destination_node_215 = ox.get_nearest_node(G, destinations.loc[215,['LAT', 'LON']])
route215 = nx.shortest_path_length(G, origin_node_0, destination_node_215, weight='length')
destination_node_216 = ox.get_nearest_node(G, destinations.loc[216, ['LAT', 'LON']])
route216 = nx.shortest_path_length(G, origin_node_0, destination_node_216, weight='length')
destination_node_217 = ox.get_nearest_node(G, destinations.loc[217, ['LAT', 'LON']])
route217 = nx.shortest_path_length(G, origin_node_0, destination_node_217, weight='length')
destination_node_218 = ox.get_nearest_node(G, destinations.loc[218, ['LAT', 'LON']])
route218 = nx.shortest_path_length(G, origin_node_0, destination_node_218, weight='length')
destination_node_219 = ox.get_nearest_node(G, destinations.loc[219, ['LAT', 'LON']])
route219 = nx.shortest_path_length(G, origin_node_0, destination_node_219, weight='length')
destination_node_220 = ox.get_nearest_node(G, destinations.loc[220,['LAT', 'LON']])
route220 = nx.shortest_path_length(G, origin_node_0, destination_node_220, weight='length')
destination_node_221 = ox.get_nearest_node(G, destinations.loc[221,['LAT', 'LON']])
route221 = nx.shortest_path_length(G, origin_node_0, destination_node_221, weight='length')
destination_node_222 = ox.get_nearest_node(G, destinations.loc[222,['LAT', 'LON']])
route222 = nx.shortest_path_length(G, origin_node_0, destination_node_222, weight='length')
destination_node_223 = ox.get_nearest_node(G, destinations.loc[223,['LAT', 'LON']])
route223 = nx.shortest_path_length(G, origin_node_0, destination_node_223, weight='length')
destination_node_224 = ox.get_nearest_node(G, destinations.loc[224,['LAT', 'LON']])
route224 = nx.shortest_path_length(G, origin_node_0, destination_node_224, weight='length')
destination_node_225 = ox.get_nearest_node(G, destinations.loc[225,['LAT', 'LON']])
route225 = nx.shortest_path_length(G, origin_node_0, destination_node_225, weight='length')
destination_node_226 = ox.get_nearest_node(G, destinations.loc[226,['LAT', 'LON']])
route226 = nx.shortest_path_length(G, origin_node_0, destination_node_226, weight='length')
destination_node_227 = ox.get_nearest_node(G, destinations.loc[227,['LAT', 'LON']])
route227 = nx.shortest_path_length(G, origin_node_0, destination_node_227, weight='length')
destination_node_228 = ox.get_nearest_node(G, destinations.loc[228,['LAT', 'LON']])
route228 = nx.shortest_path_length(G, origin_node_0, destination_node_228, weight='length')
destination_node_229 = ox.get_nearest_node(G, destinations.loc[229,['LAT', 'LON']])
route229 = nx.shortest_path_length(G, origin_node_0, destination_node_229, weight='length')
destination_node_230 = ox.get_nearest_node(G, destinations.loc[230,['LAT', 'LON']])
route230 = nx.shortest_path_length(G, origin_node_0, destination_node_230, weight='length')
destination_node_231 = ox.get_nearest_node(G, destinations.loc[231, ['LAT', 'LON']])
route231 = nx.shortest_path_length(G, origin_node_0, destination_node_231, weight='length')
destination_node_232 = ox.get_nearest_node(G, destinations.loc[232, ['LAT', 'LON']])
route232 = nx.shortest_path_length(G, origin_node_0, destination_node_232, weight='length')
destination_node_233 = ox.get_nearest_node(G, destinations.loc[233, ['LAT', 'LON']])
route233 = nx.shortest_path_length(G, origin_node_0, destination_node_233, weight='length')
destination_node_234 = ox.get_nearest_node(G, destinations.loc[234,['LAT', 'LON']])
route234 = nx.shortest_path_length(G, origin_node_0, destination_node_234, weight='length')
destination_node_235 = ox.get_nearest_node(G, destinations.loc[235,['LAT', 'LON']])
route235 = nx.shortest_path_length(G, origin_node_0, destination_node_235, weight='length')
destination_node_236 = ox.get_nearest_node(G, destinations.loc[236,['LAT', 'LON']])
route236 = nx.shortest_path_length(G, origin_node_0, destination_node_236, weight='length')
destination_node_237 = ox.get_nearest_node(G, destinations.loc[237,['LAT', 'LON']])
route237 = nx.shortest_path_length(G, origin_node_0, destination_node_237, weight='length')
destination_node_238 = ox.get_nearest_node(G, destinations.loc[238,['LAT', 'LON']])
route238 = nx.shortest_path_length(G, origin_node_0, destination_node_238, weight='length')
destination_node_239 = ox.get_nearest_node(G, destinations.loc[239,['LAT', 'LON']])
route239 = nx.shortest_path_length(G, origin_node_0, destination_node_239, weight='length')
destination_node_240 = ox.get_nearest_node(G, destinations.loc[240,['LAT', 'LON']])
route240 = nx.shortest_path_length(G, origin_node_0, destination_node_240, weight='length')
destination_node_241 = ox.get_nearest_node(G, destinations.loc[241,['LAT', 'LON']])
route241 = nx.shortest_path_length(G, origin_node_0, destination_node_241, weight='length')
destination_node_242 = ox.get_nearest_node(G, destinations.loc[242,['LAT', 'LON']])
route242 = nx.shortest_path_length(G, origin_node_0, destination_node_242, weight='length')
destination_node_243 = ox.get_nearest_node(G, destinations.loc[243,['LAT', 'LON']])
route243 = nx.shortest_path_length(G, origin_node_0, destination_node_243, weight='length')
destination_node_244 = ox.get_nearest_node(G, destinations.loc[244,['LAT', 'LON']])
route244 = nx.shortest_path_length(G, origin_node_0, destination_node_244, weight='length')
destination_node_245 = ox.get_nearest_node(G, destinations.loc[245,['LAT', 'LON']])
route245 = nx.shortest_path_length(G, origin_node_0, destination_node_245, weight='length')
destination_node_246 = ox.get_nearest_node(G, destinations.loc[246, ['LAT', 'LON']])
route246 = nx.shortest_path_length(G, origin_node_0, destination_node_246, weight='length')
destination_node_247 = ox.get_nearest_node(G, destinations.loc[247, ['LAT', 'LON']])
route247 = nx.shortest_path_length(G, origin_node_0, destination_node_247, weight='length')
destination_node_248 = ox.get_nearest_node(G, destinations.loc[248, ['LAT', 'LON']])
route248 = nx.shortest_path_length(G, origin_node_0, destination_node_248, weight='length')
destination_node_249 = ox.get_nearest_node(G, destinations.loc[249, ['LAT', 'LON']])
route249 = nx.shortest_path_length(G, origin_node_0, destination_node_249, weight='length')

route, route1, route2, route3, route4, route5, route6, route7, route8, route9, route10, route11, route12, route13, route14,
route15, route16, route17, route18, route19, route20, route21, route22, route23, route24, route25, route26, route27, route28,
route29, route30, route31, route32, route33, route34, route35, route36, route37, route38, route39, route40, route41, route42,
route43, route44, route45, route46, route47, route48, route49, route50, route51, route52, route53, route54, route55, route56,
route57, route58, route59, route60, route61, route62, route63, route64, route65, route66, route67, route68, route69, route70,
route71, route72, route73, route74, route75, route76, route77, route78, route79, route80, route81, route82, route83, route84,
route85, route86, route87, route88, route89, route90, route91, route92, route93, route94, route95, route96, route97, route98,
route99, route100, route101, route102, route103, route104, route105, route106, route107, route108, route109, route110, route111,
route112, route113, route114, route115, route116, route117, route118, route119, route120, route121, route122, route123, route124,
route125, route126, route127, route128, route129, route130, route131, route132, route133, route134, route135, route136, route137,
route137, route138, route139, route140, route141, route142, route143, route144, route145, route146, route147, route148, route149,
route150, route151, route152, route153, route154, route155, route156, route157, route158, route159, route160, route161, route162,
route163, route164, route165, route166, route167, route168, route169, route170, route171, route172, route173, route174, route175,
route176, route177, route178, route179, route180, route181, route182, route183, route184, route185, route186, route187, route188,
route189, route190, route191, route192, route193, route194, route195, route196, route197, route198, route199, route200, route201,
route202, route203, route204, route205, route206, route207, route208, route209, route210, route211, route212, route213, route214,
route215, route216, route217, route218, route219, route220, route221, route222, route223, route224, route225, route226, route227,
route228, route229, route230, route231, route232, route233, route234, route235, route236, route237, route238, route239, route240,
route241, route242, route243, route244, route245, route246, route247, route248, route249

# print mean average
print(statistics.mean([route, route1, route2, route3, route4, route5, route6, route7, route8, route9, route10, route11, route12, route13, route14,
route15, route16, route17, route18, route19, route20, route21, route22, route23, route24, route25, route26, route27, route28,
route29, route30, route31, route32, route33, route34, route35, route36, route37, route38, route39, route40, route41, route42,
route43, route44, route45, route46, route47, route48, route49, route50, route51, route52, route53, route54, route55, route56,
route57, route58, route59, route60, route61, route62, route63, route64, route65, route66, route67, route68, route69, route70,
route71, route72, route73, route74, route75, route76, route77, route78, route79, route80, route81, route82, route83, route84,
route85, route86, route87, route88, route89, route90, route91, route92, route93, route94, route95, route96, route97, route98,
route99, route100, route101, route102, route103, route104, route105, route106, route107, route108, route109, route110, route111,
route112, route113, route114, route115, route116, route117, route118, route119, route120, route121, route122, route123, route124,
route125, route126, route127, route128, route129, route130, route131, route132, route133, route134, route135, route136, route137,
route137, route138, route139, route140, route141, route142, route143, route144, route145, route146, route147, route148, route149,
route150, route151, route152, route153, route154, route155, route156, route157, route158, route159, route160, route161, route162,
route163, route164, route165, route166, route167, route168, route169, route170, route171, route172, route173, route174, route175,
route176, route177, route178, route179, route180, route181, route182, route183, route184, route185, route186, route187, route188,
route189, route190, route191, route192, route193, route194, route195, route196, route197, route198, route199, route200, route201,
route202, route203, route204, route205, route206, route207, route208, route209, route210, route211, route212, route213, route214,
route215, route216, route217, route218, route219, route220, route221, route222, route223, route224, route225, route226, route227,
route228, route229, route230, route231, route232, route233, route234, route235, route236, route237, route238, route239, route240,
route241, route242, route243, route244, route245, route246, route247, route248, route249]))






share|improve this question





















  • Welcome to Code Review! it appears you have a registered account (as evidenced by the suggested edit), which can be merged with your unregistered account. You can use the contact SE page and request the accounts be merged.
    – Sam Onela
    Aug 2 at 16:32










  • This code calculates for 2 points. Are you saying your actual codes calculates for 250 nodes? If so, please include that code instead of this example. We don't mind large pieces of code if they're accompanied by a solid explanation.
    – Mast
    Aug 3 at 7:21
















up vote
0
down vote

favorite












I am working on a project to find a contaminated water well that killed 250 people. There are seven water wells in an area.



I would like to compute shortest path lengths from each well to all deaths and calculate mean average of lengths. The well that has smallest mean average would be a candidate as a source of contamination.



Using NetworkX and Osmnx, I was able to create shortest path lengths from each well to 250 deaths. Then, I calculated mean average. I have seven mean average shortest path lengths. The code is repetition of calculation of shortest path lengths from one well to each death 250 times. I was wondering if there is a way to automate it.



import statistics
import networkx as nx
import osmnx as ox
import pandas as pd

ox.config(use_cache=True, log_console=True)
ox.__version__
ox.config(log_file=True, log_console=True, use_cache=True)

# CSV with 250 deaths locations in Latitude and Longitude
destinations = pd.read_csv('resources/destinations.csv')

# CSV with well locations in Latitude and Longitude
origins = pd.read_csv('resources/origins.csv')

# Get graph for a location
COORDINATES = (51.513578, -0.136722)
G = ox.graph_from_point(COORDINATES, network_type='walk')
fig, ax = ox.plot_graph(G)

# Get node for origin 0
origin_node_0 = ox.get_nearest_node(G, origins.loc[0, ['LAT', 'LON']])

# Get nodes for each destination
# Get shortest path length from origin node 0 to destination node 0 through 249

origin_node_0 = ox.get_nearest_node(G, origins.loc[0, ['LAT', 'LON']])

destination_node_0 = ox.get_nearest_node(G, destinations.loc[0, ['LAT', 'LON']])
route = nx.shortest_path_length(G, origin_node_0, destination_node_0, weight='length')
destination_node_1 = ox.get_nearest_node(G, destinations.loc[1, ['LAT', 'LON']])
route1 = nx.shortest_path_length(G, origin_node_0, destination_node_1, weight='length')
destination_node_2 = ox.get_nearest_node(G, destinations.loc[2, ['LAT', 'LON']])
route2 = nx.shortest_path_length(G, origin_node_0, destination_node_2, weight='length')
destination_node_3 = ox.get_nearest_node(G, destinations.loc[3, ['LAT', 'LON']])
route3 = nx.shortest_path_length(G, origin_node_0, destination_node_3, weight='length')
destination_node_4 = ox.get_nearest_node(G, destinations.loc[4,['LAT', 'LON']])
route4 = nx.shortest_path_length(G, origin_node_0, destination_node_4, weight='length')
destination_node_5 = ox.get_nearest_node(G, destinations.loc[5,['LAT', 'LON']])
route5 = nx.shortest_path_length(G, origin_node_0, destination_node_5, weight='length')
destination_node_6 = ox.get_nearest_node(G, destinations.loc[6,['LAT', 'LON']])
route6 = nx.shortest_path_length(G, origin_node_0, destination_node_6, weight='length')
destination_node_7 = ox.get_nearest_node(G, destinations.loc[7,['LAT', 'LON']])
route7 = nx.shortest_path_length(G, origin_node_0, destination_node_7, weight='length')
destination_node_8 = ox.get_nearest_node(G, destinations.loc[8,['LAT', 'LON']])
route8 = nx.shortest_path_length(G, origin_node_0, destination_node_8, weight='length')
destination_node_9 = ox.get_nearest_node(G, destinations.loc[9,['LAT', 'LON']])
route9 = nx.shortest_path_length(G, origin_node_0, destination_node_9, weight='length')
destination_node_10 = ox.get_nearest_node(G, destinations.loc[10,['LAT', 'LON']])
route10 = nx.shortest_path_length(G, origin_node_0, destination_node_10, weight='length')
destination_node_11 = ox.get_nearest_node(G, destinations.loc[11,['LAT', 'LON']])
route11 = nx.shortest_path_length(G, origin_node_0, destination_node_11, weight='length')
destination_node_12 = ox.get_nearest_node(G, destinations.loc[12,['LAT', 'LON']])
route12 = nx.shortest_path_length(G, origin_node_0, destination_node_12, weight='length')
destination_node_13 = ox.get_nearest_node(G, destinations.loc[13,['LAT', 'LON']])
route13 = nx.shortest_path_length(G, origin_node_0, destination_node_13, weight='length')
destination_node_14 = ox.get_nearest_node(G, destinations.loc[14,['LAT', 'LON']])
route14 = nx.shortest_path_length(G, origin_node_0, destination_node_14, weight='length')
destination_node_15 = ox.get_nearest_node(G, destinations.loc[15,['LAT', 'LON']])
route15 = nx.shortest_path_length(G, origin_node_0, destination_node_15, weight='length')
destination_node_16 = ox.get_nearest_node(G, destinations.loc[16, ['LAT', 'LON']])
route16 = nx.shortest_path_length(G, origin_node_0, destination_node_16, weight='length')
destination_node_17 = ox.get_nearest_node(G, destinations.loc[17, ['LAT', 'LON']])
route17 = nx.shortest_path_length(G, origin_node_0, destination_node_17, weight='length')
destination_node_18 = ox.get_nearest_node(G, destinations.loc[18, ['LAT', 'LON']])
route18 = nx.shortest_path_length(G, origin_node_0, destination_node_18, weight='length')
destination_node_19 = ox.get_nearest_node(G, destinations.loc[19, ['LAT', 'LON']])
route19 = nx.shortest_path_length(G, origin_node_0, destination_node_19, weight='length')
destination_node_20 = ox.get_nearest_node(G, destinations.loc[20,['LAT', 'LON']])
route20 = nx.shortest_path_length(G, origin_node_0, destination_node_20, weight='length')
destination_node_21 = ox.get_nearest_node(G, destinations.loc[21,['LAT', 'LON']])
route21 = nx.shortest_path_length(G, origin_node_0, destination_node_21, weight='length')
destination_node_22 = ox.get_nearest_node(G, destinations.loc[22,['LAT', 'LON']])
route22 = nx.shortest_path_length(G, origin_node_0, destination_node_22, weight='length')
destination_node_23 = ox.get_nearest_node(G, destinations.loc[23,['LAT', 'LON']])
route23 = nx.shortest_path_length(G, origin_node_0, destination_node_23, weight='length')
destination_node_24 = ox.get_nearest_node(G, destinations.loc[24,['LAT', 'LON']])
route24 = nx.shortest_path_length(G, origin_node_0, destination_node_24, weight='length')
destination_node_25 = ox.get_nearest_node(G, destinations.loc[25,['LAT', 'LON']])
route25 = nx.shortest_path_length(G, origin_node_0, destination_node_25, weight='length')
destination_node_26 = ox.get_nearest_node(G, destinations.loc[26,['LAT', 'LON']])
route26 = nx.shortest_path_length(G, origin_node_0, destination_node_26, weight='length')
destination_node_27 = ox.get_nearest_node(G, destinations.loc[27,['LAT', 'LON']])
route27 = nx.shortest_path_length(G, origin_node_0, destination_node_27, weight='length')
destination_node_28 = ox.get_nearest_node(G, destinations.loc[28,['LAT', 'LON']])
route28 = nx.shortest_path_length(G, origin_node_0, destination_node_28, weight='length')
destination_node_29 = ox.get_nearest_node(G, destinations.loc[29,['LAT', 'LON']])
route29 = nx.shortest_path_length(G, origin_node_0, destination_node_29, weight='length')
destination_node_30 = ox.get_nearest_node(G, destinations.loc[30,['LAT', 'LON']])
route30 = nx.shortest_path_length(G, origin_node_0, destination_node_30, weight='length')
destination_node_31 = ox.get_nearest_node(G, destinations.loc[31, ['LAT', 'LON']])
route31 = nx.shortest_path_length(G, origin_node_0, destination_node_31, weight='length')
destination_node_32 = ox.get_nearest_node(G, destinations.loc[32, ['LAT', 'LON']])
route32 = nx.shortest_path_length(G, origin_node_0, destination_node_32, weight='length')
destination_node_33 = ox.get_nearest_node(G, destinations.loc[33, ['LAT', 'LON']])
route33 = nx.shortest_path_length(G, origin_node_0, destination_node_33, weight='length')
destination_node_34 = ox.get_nearest_node(G, destinations.loc[34,['LAT', 'LON']])
route34 = nx.shortest_path_length(G, origin_node_0, destination_node_34, weight='length')
destination_node_35 = ox.get_nearest_node(G, destinations.loc[35,['LAT', 'LON']])
route35 = nx.shortest_path_length(G, origin_node_0, destination_node_35, weight='length')
destination_node_36 = ox.get_nearest_node(G, destinations.loc[36,['LAT', 'LON']])
route36 = nx.shortest_path_length(G, origin_node_0, destination_node_36, weight='length')
destination_node_37 = ox.get_nearest_node(G, destinations.loc[37,['LAT', 'LON']])
route37 = nx.shortest_path_length(G, origin_node_0, destination_node_37, weight='length')
destination_node_38 = ox.get_nearest_node(G, destinations.loc[38,['LAT', 'LON']])
route38 = nx.shortest_path_length(G, origin_node_0, destination_node_38, weight='length')
destination_node_39 = ox.get_nearest_node(G, destinations.loc[39,['LAT', 'LON']])
route39 = nx.shortest_path_length(G, origin_node_0, destination_node_39, weight='length')
destination_node_40 = ox.get_nearest_node(G, destinations.loc[40,['LAT', 'LON']])
route40 = nx.shortest_path_length(G, origin_node_0, destination_node_40, weight='length')
destination_node_41 = ox.get_nearest_node(G, destinations.loc[41,['LAT', 'LON']])
route41 = nx.shortest_path_length(G, origin_node_0, destination_node_41, weight='length')
destination_node_42 = ox.get_nearest_node(G, destinations.loc[42,['LAT', 'LON']])
route42 = nx.shortest_path_length(G, origin_node_0, destination_node_42, weight='length')
destination_node_43 = ox.get_nearest_node(G, destinations.loc[43,['LAT', 'LON']])
route43 = nx.shortest_path_length(G, origin_node_0, destination_node_43, weight='length')
destination_node_44 = ox.get_nearest_node(G, destinations.loc[44,['LAT', 'LON']])
route44 = nx.shortest_path_length(G, origin_node_0, destination_node_44, weight='length')
destination_node_45 = ox.get_nearest_node(G, destinations.loc[45,['LAT', 'LON']])
route45 = nx.shortest_path_length(G, origin_node_0, destination_node_45, weight='length')
destination_node_46 = ox.get_nearest_node(G, destinations.loc[46, ['LAT', 'LON']])
route46 = nx.shortest_path_length(G, origin_node_0, destination_node_46, weight='length')
destination_node_47 = ox.get_nearest_node(G, destinations.loc[47, ['LAT', 'LON']])
route47 = nx.shortest_path_length(G, origin_node_0, destination_node_47, weight='length')
destination_node_48 = ox.get_nearest_node(G, destinations.loc[48, ['LAT', 'LON']])
route48 = nx.shortest_path_length(G, origin_node_0, destination_node_48, weight='length')
destination_node_49 = ox.get_nearest_node(G, destinations.loc[49, ['LAT', 'LON']])
route49 = nx.shortest_path_length(G, origin_node_0, destination_node_49, weight='length')
destination_node_50 = ox.get_nearest_node(G, destinations.loc[50, ['LAT', 'LON']])
route50 = nx.shortest_path_length(G, origin_node_0, destination_node_50, weight='length')
destination_node_51 = ox.get_nearest_node(G, destinations.loc[51, ['LAT', 'LON']])
route51 = nx.shortest_path_length(G, origin_node_0, destination_node_51, weight='length')
destination_node_52 = ox.get_nearest_node(G, destinations.loc[52, ['LAT', 'LON']])
route52 = nx.shortest_path_length(G, origin_node_0, destination_node_52, weight='length')
destination_node_53 = ox.get_nearest_node(G, destinations.loc[53, ['LAT', 'LON']])
route53 = nx.shortest_path_length(G, origin_node_0, destination_node_53, weight='length')
destination_node_54 = ox.get_nearest_node(G, destinations.loc[54,['LAT', 'LON']])
route54 = nx.shortest_path_length(G, origin_node_0, destination_node_54, weight='length')
destination_node_55 = ox.get_nearest_node(G, destinations.loc[55,['LAT', 'LON']])
route55 = nx.shortest_path_length(G, origin_node_0, destination_node_55, weight='length')
destination_node_56 = ox.get_nearest_node(G, destinations.loc[56,['LAT', 'LON']])
route56 = nx.shortest_path_length(G, origin_node_0, destination_node_56, weight='length')
destination_node_57 = ox.get_nearest_node(G, destinations.loc[57,['LAT', 'LON']])
route57 = nx.shortest_path_length(G, origin_node_0, destination_node_57, weight='length')
destination_node_58 = ox.get_nearest_node(G, destinations.loc[58,['LAT', 'LON']])
route58 = nx.shortest_path_length(G, origin_node_0, destination_node_58, weight='length')
destination_node_59 = ox.get_nearest_node(G, destinations.loc[59,['LAT', 'LON']])
route59 = nx.shortest_path_length(G, origin_node_0, destination_node_59, weight='length')
destination_node_60 = ox.get_nearest_node(G, destinations.loc[60,['LAT', 'LON']])
route60 = nx.shortest_path_length(G, origin_node_0, destination_node_60, weight='length')
destination_node_61 = ox.get_nearest_node(G, destinations.loc[61,['LAT', 'LON']])
route61 = nx.shortest_path_length(G, origin_node_0, destination_node_61, weight='length')
destination_node_62 = ox.get_nearest_node(G, destinations.loc[62,['LAT', 'LON']])
route62 = nx.shortest_path_length(G, origin_node_0, destination_node_62, weight='length')
destination_node_63 = ox.get_nearest_node(G, destinations.loc[63,['LAT', 'LON']])
route63 = nx.shortest_path_length(G, origin_node_0, destination_node_63, weight='length')
destination_node_64 = ox.get_nearest_node(G, destinations.loc[64,['LAT', 'LON']])
route64 = nx.shortest_path_length(G, origin_node_0, destination_node_64, weight='length')
destination_node_65 = ox.get_nearest_node(G, destinations.loc[65,['LAT', 'LON']])
route65 = nx.shortest_path_length(G, origin_node_0, destination_node_65, weight='length')
destination_node_66 = ox.get_nearest_node(G, destinations.loc[66, ['LAT', 'LON']])
route66 = nx.shortest_path_length(G, origin_node_0, destination_node_66, weight='length')
destination_node_67 = ox.get_nearest_node(G, destinations.loc[67, ['LAT', 'LON']])
route67 = nx.shortest_path_length(G, origin_node_0, destination_node_67, weight='length')
destination_node_68 = ox.get_nearest_node(G, destinations.loc[68, ['LAT', 'LON']])
route68 = nx.shortest_path_length(G, origin_node_0, destination_node_68, weight='length')
destination_node_69 = ox.get_nearest_node(G, destinations.loc[69, ['LAT', 'LON']])
route69 = nx.shortest_path_length(G, origin_node_0, destination_node_69, weight='length')
destination_node_70 = ox.get_nearest_node(G, destinations.loc[70,['LAT', 'LON']])
route70 = nx.shortest_path_length(G, origin_node_0, destination_node_70, weight='length')
destination_node_71 = ox.get_nearest_node(G, destinations.loc[71,['LAT', 'LON']])
route71 = nx.shortest_path_length(G, origin_node_0, destination_node_71, weight='length')
destination_node_72 = ox.get_nearest_node(G, destinations.loc[72,['LAT', 'LON']])
route72 = nx.shortest_path_length(G, origin_node_0, destination_node_72, weight='length')
destination_node_73 = ox.get_nearest_node(G, destinations.loc[73,['LAT', 'LON']])
route73 = nx.shortest_path_length(G, origin_node_0, destination_node_73, weight='length')
destination_node_74 = ox.get_nearest_node(G, destinations.loc[74,['LAT', 'LON']])
route74 = nx.shortest_path_length(G, origin_node_0, destination_node_74, weight='length')
destination_node_75 = ox.get_nearest_node(G, destinations.loc[75,['LAT', 'LON']])
route75 = nx.shortest_path_length(G, origin_node_0, destination_node_75, weight='length')
destination_node_76 = ox.get_nearest_node(G, destinations.loc[76,['LAT', 'LON']])
route76 = nx.shortest_path_length(G, origin_node_0, destination_node_76, weight='length')
destination_node_77 = ox.get_nearest_node(G, destinations.loc[77,['LAT', 'LON']])
route77 = nx.shortest_path_length(G, origin_node_0, destination_node_77, weight='length')
destination_node_78 = ox.get_nearest_node(G, destinations.loc[78,['LAT', 'LON']])
route78 = nx.shortest_path_length(G, origin_node_0, destination_node_78, weight='length')
destination_node_79 = ox.get_nearest_node(G, destinations.loc[79,['LAT', 'LON']])
route79 = nx.shortest_path_length(G, origin_node_0, destination_node_79, weight='length')
destination_node_80 = ox.get_nearest_node(G, destinations.loc[80,['LAT', 'LON']])
route80 = nx.shortest_path_length(G, origin_node_0, destination_node_80, weight='length')
destination_node_81 = ox.get_nearest_node(G, destinations.loc[81, ['LAT', 'LON']])
route81 = nx.shortest_path_length(G, origin_node_0, destination_node_81, weight='length')
destination_node_82 = ox.get_nearest_node(G, destinations.loc[82, ['LAT', 'LON']])
route82 = nx.shortest_path_length(G, origin_node_0, destination_node_82, weight='length')
destination_node_83 = ox.get_nearest_node(G, destinations.loc[83, ['LAT', 'LON']])
route83 = nx.shortest_path_length(G, origin_node_0, destination_node_83, weight='length')
destination_node_84 = ox.get_nearest_node(G, destinations.loc[84,['LAT', 'LON']])
route84 = nx.shortest_path_length(G, origin_node_0, destination_node_84, weight='length')
destination_node_85 = ox.get_nearest_node(G, destinations.loc[85,['LAT', 'LON']])
route85 = nx.shortest_path_length(G, origin_node_0, destination_node_85, weight='length')
destination_node_86 = ox.get_nearest_node(G, destinations.loc[86,['LAT', 'LON']])
route86 = nx.shortest_path_length(G, origin_node_0, destination_node_86, weight='length')
destination_node_87 = ox.get_nearest_node(G, destinations.loc[87,['LAT', 'LON']])
route87 = nx.shortest_path_length(G, origin_node_0, destination_node_87, weight='length')
destination_node_88 = ox.get_nearest_node(G, destinations.loc[88,['LAT', 'LON']])
route88 = nx.shortest_path_length(G, origin_node_0, destination_node_88, weight='length')
destination_node_89 = ox.get_nearest_node(G, destinations.loc[89,['LAT', 'LON']])
route89 = nx.shortest_path_length(G, origin_node_0, destination_node_89, weight='length')
destination_node_90 = ox.get_nearest_node(G, destinations.loc[90,['LAT', 'LON']])
route90 = nx.shortest_path_length(G, origin_node_0, destination_node_90, weight='length')
destination_node_91 = ox.get_nearest_node(G, destinations.loc[91,['LAT', 'LON']])
route91 = nx.shortest_path_length(G, origin_node_0, destination_node_91, weight='length')
destination_node_92 = ox.get_nearest_node(G, destinations.loc[92,['LAT', 'LON']])
route92 = nx.shortest_path_length(G, origin_node_0, destination_node_92, weight='length')
destination_node_93 = ox.get_nearest_node(G, destinations.loc[93,['LAT', 'LON']])
route93 = nx.shortest_path_length(G, origin_node_0, destination_node_93, weight='length')
destination_node_94 = ox.get_nearest_node(G, destinations.loc[94,['LAT', 'LON']])
route94 = nx.shortest_path_length(G, origin_node_0, destination_node_94, weight='length')
destination_node_95 = ox.get_nearest_node(G, destinations.loc[95,['LAT', 'LON']])
route95 = nx.shortest_path_length(G, origin_node_0, destination_node_95, weight='length')
destination_node_96 = ox.get_nearest_node(G, destinations.loc[96, ['LAT', 'LON']])
route96 = nx.shortest_path_length(G, origin_node_0, destination_node_96, weight='length')
destination_node_97 = ox.get_nearest_node(G, destinations.loc[97, ['LAT', 'LON']])
route97 = nx.shortest_path_length(G, origin_node_0, destination_node_97, weight='length')
destination_node_98 = ox.get_nearest_node(G, destinations.loc[98, ['LAT', 'LON']])
route98 = nx.shortest_path_length(G, origin_node_0, destination_node_98, weight='length')
destination_node_99 = ox.get_nearest_node(G, destinations.loc[99, ['LAT', 'LON']])
route99 = nx.shortest_path_length(G, origin_node_0, destination_node_99, weight='length')
destination_node_100 = ox.get_nearest_node(G, destinations.loc[100, ['LAT', 'LON']])
route100 = nx.shortest_path_length(G, origin_node_0, destination_node_100, weight='length')
destination_node_101 = ox.get_nearest_node(G, destinations.loc[101, ['LAT', 'LON']])
route101 = nx.shortest_path_length(G, origin_node_0, destination_node_101, weight='length')
destination_node_102 = ox.get_nearest_node(G, destinations.loc[102, ['LAT', 'LON']])
route102 = nx.shortest_path_length(G, origin_node_0, destination_node_102, weight='length')
destination_node_103 = ox.get_nearest_node(G, destinations.loc[103, ['LAT', 'LON']])
route103 = nx.shortest_path_length(G, origin_node_0, destination_node_103, weight='length')
destination_node_104 = ox.get_nearest_node(G, destinations.loc[104,['LAT', 'LON']])
route104 = nx.shortest_path_length(G, origin_node_0, destination_node_104, weight='length')
destination_node_105 = ox.get_nearest_node(G, destinations.loc[105,['LAT', 'LON']])
route105 = nx.shortest_path_length(G, origin_node_0, destination_node_105, weight='length')
destination_node_106 = ox.get_nearest_node(G, destinations.loc[106,['LAT', 'LON']])
route106 = nx.shortest_path_length(G, origin_node_0, destination_node_106, weight='length')
destination_node_107 = ox.get_nearest_node(G, destinations.loc[107,['LAT', 'LON']])
route107 = nx.shortest_path_length(G, origin_node_0, destination_node_107, weight='length')
destination_node_108 = ox.get_nearest_node(G, destinations.loc[108,['LAT', 'LON']])
route108 = nx.shortest_path_length(G, origin_node_0, destination_node_108, weight='length')
destination_node_109 = ox.get_nearest_node(G, destinations.loc[109,['LAT', 'LON']])
route109 = nx.shortest_path_length(G, origin_node_0, destination_node_109, weight='length')
destination_node_110 = ox.get_nearest_node(G, destinations.loc[110,['LAT', 'LON']])
route110 = nx.shortest_path_length(G, origin_node_0, destination_node_110, weight='length')
destination_node_111 = ox.get_nearest_node(G, destinations.loc[111,['LAT', 'LON']])
route111 = nx.shortest_path_length(G, origin_node_0, destination_node_111, weight='length')
destination_node_112 = ox.get_nearest_node(G, destinations.loc[112,['LAT', 'LON']])
route112 = nx.shortest_path_length(G, origin_node_0, destination_node_112, weight='length')
destination_node_113 = ox.get_nearest_node(G, destinations.loc[113,['LAT', 'LON']])
route113 = nx.shortest_path_length(G, origin_node_0, destination_node_113, weight='length')
destination_node_114 = ox.get_nearest_node(G, destinations.loc[114,['LAT', 'LON']])
route114 = nx.shortest_path_length(G, origin_node_0, destination_node_114, weight='length')
destination_node_115 = ox.get_nearest_node(G, destinations.loc[115,['LAT', 'LON']])
route115 = nx.shortest_path_length(G, origin_node_0, destination_node_115, weight='length')
destination_node_116 = ox.get_nearest_node(G, destinations.loc[116, ['LAT', 'LON']])
route116 = nx.shortest_path_length(G, origin_node_0, destination_node_116, weight='length')
destination_node_117 = ox.get_nearest_node(G, destinations.loc[117, ['LAT', 'LON']])
route117 = nx.shortest_path_length(G, origin_node_0, destination_node_117, weight='length')
destination_node_118 = ox.get_nearest_node(G, destinations.loc[118, ['LAT', 'LON']])
route118 = nx.shortest_path_length(G, origin_node_0, destination_node_118, weight='length')
destination_node_119 = ox.get_nearest_node(G, destinations.loc[119, ['LAT', 'LON']])
route119 = nx.shortest_path_length(G, origin_node_0, destination_node_119, weight='length')
destination_node_120 = ox.get_nearest_node(G, destinations.loc[120,['LAT', 'LON']])
route120 = nx.shortest_path_length(G, origin_node_0, destination_node_120, weight='length')
destination_node_121 = ox.get_nearest_node(G, destinations.loc[121,['LAT', 'LON']])
route121 = nx.shortest_path_length(G, origin_node_0, destination_node_121, weight='length')
destination_node_122 = ox.get_nearest_node(G, destinations.loc[122,['LAT', 'LON']])
route122 = nx.shortest_path_length(G, origin_node_0, destination_node_122, weight='length')
destination_node_123 = ox.get_nearest_node(G, destinations.loc[123,['LAT', 'LON']])
route123 = nx.shortest_path_length(G, origin_node_0, destination_node_123, weight='length')
destination_node_124 = ox.get_nearest_node(G, destinations.loc[124,['LAT', 'LON']])
route124 = nx.shortest_path_length(G, origin_node_0, destination_node_124, weight='length')
destination_node_125 = ox.get_nearest_node(G, destinations.loc[125,['LAT', 'LON']])
route125 = nx.shortest_path_length(G, origin_node_0, destination_node_125, weight='length')
destination_node_126 = ox.get_nearest_node(G, destinations.loc[126,['LAT', 'LON']])
route126 = nx.shortest_path_length(G, origin_node_0, destination_node_126, weight='length')
destination_node_127 = ox.get_nearest_node(G, destinations.loc[127,['LAT', 'LON']])
route127 = nx.shortest_path_length(G, origin_node_0, destination_node_127, weight='length')
destination_node_128 = ox.get_nearest_node(G, destinations.loc[128,['LAT', 'LON']])
route128 = nx.shortest_path_length(G, origin_node_0, destination_node_128, weight='length')
destination_node_129 = ox.get_nearest_node(G, destinations.loc[129,['LAT', 'LON']])
route129 = nx.shortest_path_length(G, origin_node_0, destination_node_129, weight='length')
destination_node_130 = ox.get_nearest_node(G, destinations.loc[130,['LAT', 'LON']])
route130 = nx.shortest_path_length(G, origin_node_0, destination_node_130, weight='length')
destination_node_131 = ox.get_nearest_node(G, destinations.loc[131, ['LAT', 'LON']])
route131 = nx.shortest_path_length(G, origin_node_0, destination_node_131, weight='length')
destination_node_132 = ox.get_nearest_node(G, destinations.loc[132, ['LAT', 'LON']])
route132 = nx.shortest_path_length(G, origin_node_0, destination_node_132, weight='length')
destination_node_133 = ox.get_nearest_node(G, destinations.loc[133, ['LAT', 'LON']])
route133 = nx.shortest_path_length(G, origin_node_0, destination_node_133, weight='length')
destination_node_134 = ox.get_nearest_node(G, destinations.loc[134,['LAT', 'LON']])
route134 = nx.shortest_path_length(G, origin_node_0, destination_node_134, weight='length')
destination_node_135 = ox.get_nearest_node(G, destinations.loc[135,['LAT', 'LON']])
route135 = nx.shortest_path_length(G, origin_node_0, destination_node_135, weight='length')
destination_node_136 = ox.get_nearest_node(G, destinations.loc[136,['LAT', 'LON']])
route136 = nx.shortest_path_length(G, origin_node_0, destination_node_136, weight='length')
destination_node_137 = ox.get_nearest_node(G, destinations.loc[137,['LAT', 'LON']])
route137 = nx.shortest_path_length(G, origin_node_0, destination_node_137, weight='length')
destination_node_138 = ox.get_nearest_node(G, destinations.loc[138,['LAT', 'LON']])
route138 = nx.shortest_path_length(G, origin_node_0, destination_node_138, weight='length')
destination_node_139 = ox.get_nearest_node(G, destinations.loc[139,['LAT', 'LON']])
route139 = nx.shortest_path_length(G, origin_node_0, destination_node_139, weight='length')
destination_node_140 = ox.get_nearest_node(G, destinations.loc[140,['LAT', 'LON']])
route140 = nx.shortest_path_length(G, origin_node_0, destination_node_140, weight='length')
destination_node_141 = ox.get_nearest_node(G, destinations.loc[141,['LAT', 'LON']])
route141 = nx.shortest_path_length(G, origin_node_0, destination_node_141, weight='length')
destination_node_142 = ox.get_nearest_node(G, destinations.loc[142,['LAT', 'LON']])
route142 = nx.shortest_path_length(G, origin_node_0, destination_node_142, weight='length')
destination_node_143 = ox.get_nearest_node(G, destinations.loc[143,['LAT', 'LON']])
route143 = nx.shortest_path_length(G, origin_node_0, destination_node_143, weight='length')
destination_node_144 = ox.get_nearest_node(G, destinations.loc[144,['LAT', 'LON']])
route144 = nx.shortest_path_length(G, origin_node_0, destination_node_144, weight='length')
destination_node_145 = ox.get_nearest_node(G, destinations.loc[145,['LAT', 'LON']])
route145 = nx.shortest_path_length(G, origin_node_0, destination_node_145, weight='length')
destination_node_146 = ox.get_nearest_node(G, destinations.loc[146, ['LAT', 'LON']])
route146 = nx.shortest_path_length(G, origin_node_0, destination_node_146, weight='length')
destination_node_147 = ox.get_nearest_node(G, destinations.loc[147, ['LAT', 'LON']])
route147 = nx.shortest_path_length(G, origin_node_0, destination_node_147, weight='length')
destination_node_148 = ox.get_nearest_node(G, destinations.loc[148, ['LAT', 'LON']])
route148 = nx.shortest_path_length(G, origin_node_0, destination_node_148, weight='length')
destination_node_149 = ox.get_nearest_node(G, destinations.loc[149, ['LAT', 'LON']])
route149 = nx.shortest_path_length(G, origin_node_0, destination_node_149, weight='length')
destination_node_150 = ox.get_nearest_node(G, destinations.loc[150, ['LAT', 'LON']])
route150 = nx.shortest_path_length(G, origin_node_0, destination_node_150, weight='length')
destination_node_151 = ox.get_nearest_node(G, destinations.loc[151, ['LAT', 'LON']])
route151 = nx.shortest_path_length(G, origin_node_0, destination_node_151, weight='length')
destination_node_152 = ox.get_nearest_node(G, destinations.loc[152, ['LAT', 'LON']])
route152 = nx.shortest_path_length(G, origin_node_0, destination_node_152, weight='length')
destination_node_153 = ox.get_nearest_node(G, destinations.loc[153, ['LAT', 'LON']])
route153 = nx.shortest_path_length(G, origin_node_0, destination_node_153, weight='length')
destination_node_154 = ox.get_nearest_node(G, destinations.loc[154,['LAT', 'LON']])
route154 = nx.shortest_path_length(G, origin_node_0, destination_node_154, weight='length')
destination_node_155 = ox.get_nearest_node(G, destinations.loc[155,['LAT', 'LON']])
route155 = nx.shortest_path_length(G, origin_node_0, destination_node_155, weight='length')
destination_node_156 = ox.get_nearest_node(G, destinations.loc[156,['LAT', 'LON']])
route156 = nx.shortest_path_length(G, origin_node_0, destination_node_156, weight='length')
destination_node_157 = ox.get_nearest_node(G, destinations.loc[157,['LAT', 'LON']])
route157 = nx.shortest_path_length(G, origin_node_0, destination_node_157, weight='length')
destination_node_158 = ox.get_nearest_node(G, destinations.loc[158,['LAT', 'LON']])
route158 = nx.shortest_path_length(G, origin_node_0, destination_node_158, weight='length')
destination_node_159 = ox.get_nearest_node(G, destinations.loc[159,['LAT', 'LON']])
route159 = nx.shortest_path_length(G, origin_node_0, destination_node_159, weight='length')
destination_node_160 = ox.get_nearest_node(G, destinations.loc[160,['LAT', 'LON']])
route160 = nx.shortest_path_length(G, origin_node_0, destination_node_160, weight='length')
destination_node_161 = ox.get_nearest_node(G, destinations.loc[161,['LAT', 'LON']])
route161 = nx.shortest_path_length(G, origin_node_0, destination_node_161, weight='length')
destination_node_162 = ox.get_nearest_node(G, destinations.loc[162,['LAT', 'LON']])
route162 = nx.shortest_path_length(G, origin_node_0, destination_node_162, weight='length')
destination_node_163 = ox.get_nearest_node(G, destinations.loc[163,['LAT', 'LON']])
route163 = nx.shortest_path_length(G, origin_node_0, destination_node_163, weight='length')
destination_node_164 = ox.get_nearest_node(G, destinations.loc[164,['LAT', 'LON']])
route164 = nx.shortest_path_length(G, origin_node_0, destination_node_164, weight='length')
destination_node_165 = ox.get_nearest_node(G, destinations.loc[165,['LAT', 'LON']])
route165 = nx.shortest_path_length(G, origin_node_0, destination_node_165, weight='length')
destination_node_166 = ox.get_nearest_node(G, destinations.loc[166, ['LAT', 'LON']])
route166 = nx.shortest_path_length(G, origin_node_0, destination_node_166, weight='length')
destination_node_167 = ox.get_nearest_node(G, destinations.loc[167, ['LAT', 'LON']])
route167 = nx.shortest_path_length(G, origin_node_0, destination_node_167, weight='length')
destination_node_168 = ox.get_nearest_node(G, destinations.loc[168, ['LAT', 'LON']])
route168 = nx.shortest_path_length(G, origin_node_0, destination_node_168, weight='length')
destination_node_169 = ox.get_nearest_node(G, destinations.loc[169, ['LAT', 'LON']])
route169 = nx.shortest_path_length(G, origin_node_0, destination_node_169, weight='length')
destination_node_170 = ox.get_nearest_node(G, destinations.loc[170,['LAT', 'LON']])
route170 = nx.shortest_path_length(G, origin_node_0, destination_node_170, weight='length')
destination_node_171 = ox.get_nearest_node(G, destinations.loc[171,['LAT', 'LON']])
route171 = nx.shortest_path_length(G, origin_node_0, destination_node_171, weight='length')
destination_node_172 = ox.get_nearest_node(G, destinations.loc[172,['LAT', 'LON']])
route172 = nx.shortest_path_length(G, origin_node_0, destination_node_172, weight='length')
destination_node_173 = ox.get_nearest_node(G, destinations.loc[173,['LAT', 'LON']])
route173 = nx.shortest_path_length(G, origin_node_0, destination_node_173, weight='length')
destination_node_174 = ox.get_nearest_node(G, destinations.loc[174,['LAT', 'LON']])
route174 = nx.shortest_path_length(G, origin_node_0, destination_node_174, weight='length')
destination_node_175 = ox.get_nearest_node(G, destinations.loc[175,['LAT', 'LON']])
route175 = nx.shortest_path_length(G, origin_node_0, destination_node_175, weight='length')
destination_node_176 = ox.get_nearest_node(G, destinations.loc[176,['LAT', 'LON']])
route176 = nx.shortest_path_length(G, origin_node_0, destination_node_176, weight='length')
destination_node_177 = ox.get_nearest_node(G, destinations.loc[177,['LAT', 'LON']])
route177 = nx.shortest_path_length(G, origin_node_0, destination_node_177, weight='length')
destination_node_178 = ox.get_nearest_node(G, destinations.loc[178,['LAT', 'LON']])
route178 = nx.shortest_path_length(G, origin_node_0, destination_node_178, weight='length')
destination_node_179 = ox.get_nearest_node(G, destinations.loc[179,['LAT', 'LON']])
route179 = nx.shortest_path_length(G, origin_node_0, destination_node_179, weight='length')
destination_node_180 = ox.get_nearest_node(G, destinations.loc[180,['LAT', 'LON']])
route180 = nx.shortest_path_length(G, origin_node_0, destination_node_180, weight='length')
destination_node_181 = ox.get_nearest_node(G, destinations.loc[181, ['LAT', 'LON']])
route181 = nx.shortest_path_length(G, origin_node_0, destination_node_181, weight='length')
destination_node_182 = ox.get_nearest_node(G, destinations.loc[182, ['LAT', 'LON']])
route182 = nx.shortest_path_length(G, origin_node_0, destination_node_182, weight='length')
destination_node_183 = ox.get_nearest_node(G, destinations.loc[183, ['LAT', 'LON']])
route183 = nx.shortest_path_length(G, origin_node_0, destination_node_183, weight='length')
destination_node_184 = ox.get_nearest_node(G, destinations.loc[184,['LAT', 'LON']])
route184 = nx.shortest_path_length(G, origin_node_0, destination_node_184, weight='length')
destination_node_185 = ox.get_nearest_node(G, destinations.loc[185,['LAT', 'LON']])
route185 = nx.shortest_path_length(G, origin_node_0, destination_node_185, weight='length')
destination_node_186 = ox.get_nearest_node(G, destinations.loc[186,['LAT', 'LON']])
route186 = nx.shortest_path_length(G, origin_node_0, destination_node_186, weight='length')
destination_node_187 = ox.get_nearest_node(G, destinations.loc[187,['LAT', 'LON']])
route187 = nx.shortest_path_length(G, origin_node_0, destination_node_187, weight='length')
destination_node_188 = ox.get_nearest_node(G, destinations.loc[188,['LAT', 'LON']])
route188 = nx.shortest_path_length(G, origin_node_0, destination_node_188, weight='length')
destination_node_189 = ox.get_nearest_node(G, destinations.loc[189,['LAT', 'LON']])
route189 = nx.shortest_path_length(G, origin_node_0, destination_node_189, weight='length')
destination_node_190 = ox.get_nearest_node(G, destinations.loc[190,['LAT', 'LON']])
route190 = nx.shortest_path_length(G, origin_node_0, destination_node_190, weight='length')
destination_node_191 = ox.get_nearest_node(G, destinations.loc[191,['LAT', 'LON']])
route191 = nx.shortest_path_length(G, origin_node_0, destination_node_191, weight='length')
destination_node_192 = ox.get_nearest_node(G, destinations.loc[192,['LAT', 'LON']])
route192 = nx.shortest_path_length(G, origin_node_0, destination_node_192, weight='length')
destination_node_193 = ox.get_nearest_node(G, destinations.loc[193,['LAT', 'LON']])
route193 = nx.shortest_path_length(G, origin_node_0, destination_node_193, weight='length')
destination_node_194 = ox.get_nearest_node(G, destinations.loc[194,['LAT', 'LON']])
route194 = nx.shortest_path_length(G, origin_node_0, destination_node_194, weight='length')
destination_node_195 = ox.get_nearest_node(G, destinations.loc[195,['LAT', 'LON']])
route195 = nx.shortest_path_length(G, origin_node_0, destination_node_195, weight='length')
destination_node_196 = ox.get_nearest_node(G, destinations.loc[196, ['LAT', 'LON']])
route196 = nx.shortest_path_length(G, origin_node_0, destination_node_196, weight='length')
destination_node_197 = ox.get_nearest_node(G, destinations.loc[197, ['LAT', 'LON']])
route197 = nx.shortest_path_length(G, origin_node_0, destination_node_197, weight='length')
destination_node_198 = ox.get_nearest_node(G, destinations.loc[198, ['LAT', 'LON']])
route198 = nx.shortest_path_length(G, origin_node_0, destination_node_198, weight='length')
destination_node_199 = ox.get_nearest_node(G, destinations.loc[199, ['LAT', 'LON']])
route199 = nx.shortest_path_length(G, origin_node_0, destination_node_199, weight='length')
destination_node_200 = ox.get_nearest_node(G, destinations.loc[200, ['LAT', 'LON']])
route200 = nx.shortest_path_length(G, origin_node_0, destination_node_200, weight='length')
destination_node_201 = ox.get_nearest_node(G, destinations.loc[201, ['LAT', 'LON']])
route201 = nx.shortest_path_length(G, origin_node_0, destination_node_201, weight='length')
destination_node_202 = ox.get_nearest_node(G, destinations.loc[202, ['LAT', 'LON']])
route202 = nx.shortest_path_length(G, origin_node_0, destination_node_202, weight='length')
destination_node_203 = ox.get_nearest_node(G, destinations.loc[203, ['LAT', 'LON']])
route203 = nx.shortest_path_length(G, origin_node_0, destination_node_203, weight='length')
destination_node_204 = ox.get_nearest_node(G, destinations.loc[204,['LAT', 'LON']])
route204 = nx.shortest_path_length(G, origin_node_0, destination_node_204, weight='length')
destination_node_205 = ox.get_nearest_node(G, destinations.loc[205,['LAT', 'LON']])
route205 = nx.shortest_path_length(G, origin_node_0, destination_node_205, weight='length')
destination_node_206 = ox.get_nearest_node(G, destinations.loc[206,['LAT', 'LON']])
route206 = nx.shortest_path_length(G, origin_node_0, destination_node_206, weight='length')
destination_node_207 = ox.get_nearest_node(G, destinations.loc[207,['LAT', 'LON']])
route207 = nx.shortest_path_length(G, origin_node_0, destination_node_207, weight='length')
destination_node_208 = ox.get_nearest_node(G, destinations.loc[208,['LAT', 'LON']])
route208 = nx.shortest_path_length(G, origin_node_0, destination_node_208, weight='length')
destination_node_209 = ox.get_nearest_node(G, destinations.loc[209,['LAT', 'LON']])
route209 = nx.shortest_path_length(G, origin_node_0, destination_node_209, weight='length')
destination_node_210 = ox.get_nearest_node(G, destinations.loc[210,['LAT', 'LON']])
route210 = nx.shortest_path_length(G, origin_node_0, destination_node_210, weight='length')
destination_node_211 = ox.get_nearest_node(G, destinations.loc[211,['LAT', 'LON']])
route211 = nx.shortest_path_length(G, origin_node_0, destination_node_211, weight='length')
destination_node_212 = ox.get_nearest_node(G, destinations.loc[212,['LAT', 'LON']])
route212 = nx.shortest_path_length(G, origin_node_0, destination_node_212, weight='length')
destination_node_213 = ox.get_nearest_node(G, destinations.loc[213,['LAT', 'LON']])
route213 = nx.shortest_path_length(G, origin_node_0, destination_node_213, weight='length')
destination_node_214 = ox.get_nearest_node(G, destinations.loc[214,['LAT', 'LON']])
route214 = nx.shortest_path_length(G, origin_node_0, destination_node_214, weight='length')
destination_node_215 = ox.get_nearest_node(G, destinations.loc[215,['LAT', 'LON']])
route215 = nx.shortest_path_length(G, origin_node_0, destination_node_215, weight='length')
destination_node_216 = ox.get_nearest_node(G, destinations.loc[216, ['LAT', 'LON']])
route216 = nx.shortest_path_length(G, origin_node_0, destination_node_216, weight='length')
destination_node_217 = ox.get_nearest_node(G, destinations.loc[217, ['LAT', 'LON']])
route217 = nx.shortest_path_length(G, origin_node_0, destination_node_217, weight='length')
destination_node_218 = ox.get_nearest_node(G, destinations.loc[218, ['LAT', 'LON']])
route218 = nx.shortest_path_length(G, origin_node_0, destination_node_218, weight='length')
destination_node_219 = ox.get_nearest_node(G, destinations.loc[219, ['LAT', 'LON']])
route219 = nx.shortest_path_length(G, origin_node_0, destination_node_219, weight='length')
destination_node_220 = ox.get_nearest_node(G, destinations.loc[220,['LAT', 'LON']])
route220 = nx.shortest_path_length(G, origin_node_0, destination_node_220, weight='length')
destination_node_221 = ox.get_nearest_node(G, destinations.loc[221,['LAT', 'LON']])
route221 = nx.shortest_path_length(G, origin_node_0, destination_node_221, weight='length')
destination_node_222 = ox.get_nearest_node(G, destinations.loc[222,['LAT', 'LON']])
route222 = nx.shortest_path_length(G, origin_node_0, destination_node_222, weight='length')
destination_node_223 = ox.get_nearest_node(G, destinations.loc[223,['LAT', 'LON']])
route223 = nx.shortest_path_length(G, origin_node_0, destination_node_223, weight='length')
destination_node_224 = ox.get_nearest_node(G, destinations.loc[224,['LAT', 'LON']])
route224 = nx.shortest_path_length(G, origin_node_0, destination_node_224, weight='length')
destination_node_225 = ox.get_nearest_node(G, destinations.loc[225,['LAT', 'LON']])
route225 = nx.shortest_path_length(G, origin_node_0, destination_node_225, weight='length')
destination_node_226 = ox.get_nearest_node(G, destinations.loc[226,['LAT', 'LON']])
route226 = nx.shortest_path_length(G, origin_node_0, destination_node_226, weight='length')
destination_node_227 = ox.get_nearest_node(G, destinations.loc[227,['LAT', 'LON']])
route227 = nx.shortest_path_length(G, origin_node_0, destination_node_227, weight='length')
destination_node_228 = ox.get_nearest_node(G, destinations.loc[228,['LAT', 'LON']])
route228 = nx.shortest_path_length(G, origin_node_0, destination_node_228, weight='length')
destination_node_229 = ox.get_nearest_node(G, destinations.loc[229,['LAT', 'LON']])
route229 = nx.shortest_path_length(G, origin_node_0, destination_node_229, weight='length')
destination_node_230 = ox.get_nearest_node(G, destinations.loc[230,['LAT', 'LON']])
route230 = nx.shortest_path_length(G, origin_node_0, destination_node_230, weight='length')
destination_node_231 = ox.get_nearest_node(G, destinations.loc[231, ['LAT', 'LON']])
route231 = nx.shortest_path_length(G, origin_node_0, destination_node_231, weight='length')
destination_node_232 = ox.get_nearest_node(G, destinations.loc[232, ['LAT', 'LON']])
route232 = nx.shortest_path_length(G, origin_node_0, destination_node_232, weight='length')
destination_node_233 = ox.get_nearest_node(G, destinations.loc[233, ['LAT', 'LON']])
route233 = nx.shortest_path_length(G, origin_node_0, destination_node_233, weight='length')
destination_node_234 = ox.get_nearest_node(G, destinations.loc[234,['LAT', 'LON']])
route234 = nx.shortest_path_length(G, origin_node_0, destination_node_234, weight='length')
destination_node_235 = ox.get_nearest_node(G, destinations.loc[235,['LAT', 'LON']])
route235 = nx.shortest_path_length(G, origin_node_0, destination_node_235, weight='length')
destination_node_236 = ox.get_nearest_node(G, destinations.loc[236,['LAT', 'LON']])
route236 = nx.shortest_path_length(G, origin_node_0, destination_node_236, weight='length')
destination_node_237 = ox.get_nearest_node(G, destinations.loc[237,['LAT', 'LON']])
route237 = nx.shortest_path_length(G, origin_node_0, destination_node_237, weight='length')
destination_node_238 = ox.get_nearest_node(G, destinations.loc[238,['LAT', 'LON']])
route238 = nx.shortest_path_length(G, origin_node_0, destination_node_238, weight='length')
destination_node_239 = ox.get_nearest_node(G, destinations.loc[239,['LAT', 'LON']])
route239 = nx.shortest_path_length(G, origin_node_0, destination_node_239, weight='length')
destination_node_240 = ox.get_nearest_node(G, destinations.loc[240,['LAT', 'LON']])
route240 = nx.shortest_path_length(G, origin_node_0, destination_node_240, weight='length')
destination_node_241 = ox.get_nearest_node(G, destinations.loc[241,['LAT', 'LON']])
route241 = nx.shortest_path_length(G, origin_node_0, destination_node_241, weight='length')
destination_node_242 = ox.get_nearest_node(G, destinations.loc[242,['LAT', 'LON']])
route242 = nx.shortest_path_length(G, origin_node_0, destination_node_242, weight='length')
destination_node_243 = ox.get_nearest_node(G, destinations.loc[243,['LAT', 'LON']])
route243 = nx.shortest_path_length(G, origin_node_0, destination_node_243, weight='length')
destination_node_244 = ox.get_nearest_node(G, destinations.loc[244,['LAT', 'LON']])
route244 = nx.shortest_path_length(G, origin_node_0, destination_node_244, weight='length')
destination_node_245 = ox.get_nearest_node(G, destinations.loc[245,['LAT', 'LON']])
route245 = nx.shortest_path_length(G, origin_node_0, destination_node_245, weight='length')
destination_node_246 = ox.get_nearest_node(G, destinations.loc[246, ['LAT', 'LON']])
route246 = nx.shortest_path_length(G, origin_node_0, destination_node_246, weight='length')
destination_node_247 = ox.get_nearest_node(G, destinations.loc[247, ['LAT', 'LON']])
route247 = nx.shortest_path_length(G, origin_node_0, destination_node_247, weight='length')
destination_node_248 = ox.get_nearest_node(G, destinations.loc[248, ['LAT', 'LON']])
route248 = nx.shortest_path_length(G, origin_node_0, destination_node_248, weight='length')
destination_node_249 = ox.get_nearest_node(G, destinations.loc[249, ['LAT', 'LON']])
route249 = nx.shortest_path_length(G, origin_node_0, destination_node_249, weight='length')

route, route1, route2, route3, route4, route5, route6, route7, route8, route9, route10, route11, route12, route13, route14,
route15, route16, route17, route18, route19, route20, route21, route22, route23, route24, route25, route26, route27, route28,
route29, route30, route31, route32, route33, route34, route35, route36, route37, route38, route39, route40, route41, route42,
route43, route44, route45, route46, route47, route48, route49, route50, route51, route52, route53, route54, route55, route56,
route57, route58, route59, route60, route61, route62, route63, route64, route65, route66, route67, route68, route69, route70,
route71, route72, route73, route74, route75, route76, route77, route78, route79, route80, route81, route82, route83, route84,
route85, route86, route87, route88, route89, route90, route91, route92, route93, route94, route95, route96, route97, route98,
route99, route100, route101, route102, route103, route104, route105, route106, route107, route108, route109, route110, route111,
route112, route113, route114, route115, route116, route117, route118, route119, route120, route121, route122, route123, route124,
route125, route126, route127, route128, route129, route130, route131, route132, route133, route134, route135, route136, route137,
route137, route138, route139, route140, route141, route142, route143, route144, route145, route146, route147, route148, route149,
route150, route151, route152, route153, route154, route155, route156, route157, route158, route159, route160, route161, route162,
route163, route164, route165, route166, route167, route168, route169, route170, route171, route172, route173, route174, route175,
route176, route177, route178, route179, route180, route181, route182, route183, route184, route185, route186, route187, route188,
route189, route190, route191, route192, route193, route194, route195, route196, route197, route198, route199, route200, route201,
route202, route203, route204, route205, route206, route207, route208, route209, route210, route211, route212, route213, route214,
route215, route216, route217, route218, route219, route220, route221, route222, route223, route224, route225, route226, route227,
route228, route229, route230, route231, route232, route233, route234, route235, route236, route237, route238, route239, route240,
route241, route242, route243, route244, route245, route246, route247, route248, route249

# print mean average
print(statistics.mean([route, route1, route2, route3, route4, route5, route6, route7, route8, route9, route10, route11, route12, route13, route14,
route15, route16, route17, route18, route19, route20, route21, route22, route23, route24, route25, route26, route27, route28,
route29, route30, route31, route32, route33, route34, route35, route36, route37, route38, route39, route40, route41, route42,
route43, route44, route45, route46, route47, route48, route49, route50, route51, route52, route53, route54, route55, route56,
route57, route58, route59, route60, route61, route62, route63, route64, route65, route66, route67, route68, route69, route70,
route71, route72, route73, route74, route75, route76, route77, route78, route79, route80, route81, route82, route83, route84,
route85, route86, route87, route88, route89, route90, route91, route92, route93, route94, route95, route96, route97, route98,
route99, route100, route101, route102, route103, route104, route105, route106, route107, route108, route109, route110, route111,
route112, route113, route114, route115, route116, route117, route118, route119, route120, route121, route122, route123, route124,
route125, route126, route127, route128, route129, route130, route131, route132, route133, route134, route135, route136, route137,
route137, route138, route139, route140, route141, route142, route143, route144, route145, route146, route147, route148, route149,
route150, route151, route152, route153, route154, route155, route156, route157, route158, route159, route160, route161, route162,
route163, route164, route165, route166, route167, route168, route169, route170, route171, route172, route173, route174, route175,
route176, route177, route178, route179, route180, route181, route182, route183, route184, route185, route186, route187, route188,
route189, route190, route191, route192, route193, route194, route195, route196, route197, route198, route199, route200, route201,
route202, route203, route204, route205, route206, route207, route208, route209, route210, route211, route212, route213, route214,
route215, route216, route217, route218, route219, route220, route221, route222, route223, route224, route225, route226, route227,
route228, route229, route230, route231, route232, route233, route234, route235, route236, route237, route238, route239, route240,
route241, route242, route243, route244, route245, route246, route247, route248, route249]))






share|improve this question





















  • Welcome to Code Review! it appears you have a registered account (as evidenced by the suggested edit), which can be merged with your unregistered account. You can use the contact SE page and request the accounts be merged.
    – Sam Onela
    Aug 2 at 16:32










  • This code calculates for 2 points. Are you saying your actual codes calculates for 250 nodes? If so, please include that code instead of this example. We don't mind large pieces of code if they're accompanied by a solid explanation.
    – Mast
    Aug 3 at 7:21












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am working on a project to find a contaminated water well that killed 250 people. There are seven water wells in an area.



I would like to compute shortest path lengths from each well to all deaths and calculate mean average of lengths. The well that has smallest mean average would be a candidate as a source of contamination.



Using NetworkX and Osmnx, I was able to create shortest path lengths from each well to 250 deaths. Then, I calculated mean average. I have seven mean average shortest path lengths. The code is repetition of calculation of shortest path lengths from one well to each death 250 times. I was wondering if there is a way to automate it.



import statistics
import networkx as nx
import osmnx as ox
import pandas as pd

ox.config(use_cache=True, log_console=True)
ox.__version__
ox.config(log_file=True, log_console=True, use_cache=True)

# CSV with 250 deaths locations in Latitude and Longitude
destinations = pd.read_csv('resources/destinations.csv')

# CSV with well locations in Latitude and Longitude
origins = pd.read_csv('resources/origins.csv')

# Get graph for a location
COORDINATES = (51.513578, -0.136722)
G = ox.graph_from_point(COORDINATES, network_type='walk')
fig, ax = ox.plot_graph(G)

# Get node for origin 0
origin_node_0 = ox.get_nearest_node(G, origins.loc[0, ['LAT', 'LON']])

# Get nodes for each destination
# Get shortest path length from origin node 0 to destination node 0 through 249

origin_node_0 = ox.get_nearest_node(G, origins.loc[0, ['LAT', 'LON']])

destination_node_0 = ox.get_nearest_node(G, destinations.loc[0, ['LAT', 'LON']])
route = nx.shortest_path_length(G, origin_node_0, destination_node_0, weight='length')
destination_node_1 = ox.get_nearest_node(G, destinations.loc[1, ['LAT', 'LON']])
route1 = nx.shortest_path_length(G, origin_node_0, destination_node_1, weight='length')
destination_node_2 = ox.get_nearest_node(G, destinations.loc[2, ['LAT', 'LON']])
route2 = nx.shortest_path_length(G, origin_node_0, destination_node_2, weight='length')
destination_node_3 = ox.get_nearest_node(G, destinations.loc[3, ['LAT', 'LON']])
route3 = nx.shortest_path_length(G, origin_node_0, destination_node_3, weight='length')
destination_node_4 = ox.get_nearest_node(G, destinations.loc[4,['LAT', 'LON']])
route4 = nx.shortest_path_length(G, origin_node_0, destination_node_4, weight='length')
destination_node_5 = ox.get_nearest_node(G, destinations.loc[5,['LAT', 'LON']])
route5 = nx.shortest_path_length(G, origin_node_0, destination_node_5, weight='length')
destination_node_6 = ox.get_nearest_node(G, destinations.loc[6,['LAT', 'LON']])
route6 = nx.shortest_path_length(G, origin_node_0, destination_node_6, weight='length')
destination_node_7 = ox.get_nearest_node(G, destinations.loc[7,['LAT', 'LON']])
route7 = nx.shortest_path_length(G, origin_node_0, destination_node_7, weight='length')
destination_node_8 = ox.get_nearest_node(G, destinations.loc[8,['LAT', 'LON']])
route8 = nx.shortest_path_length(G, origin_node_0, destination_node_8, weight='length')
destination_node_9 = ox.get_nearest_node(G, destinations.loc[9,['LAT', 'LON']])
route9 = nx.shortest_path_length(G, origin_node_0, destination_node_9, weight='length')
destination_node_10 = ox.get_nearest_node(G, destinations.loc[10,['LAT', 'LON']])
route10 = nx.shortest_path_length(G, origin_node_0, destination_node_10, weight='length')
destination_node_11 = ox.get_nearest_node(G, destinations.loc[11,['LAT', 'LON']])
route11 = nx.shortest_path_length(G, origin_node_0, destination_node_11, weight='length')
destination_node_12 = ox.get_nearest_node(G, destinations.loc[12,['LAT', 'LON']])
route12 = nx.shortest_path_length(G, origin_node_0, destination_node_12, weight='length')
destination_node_13 = ox.get_nearest_node(G, destinations.loc[13,['LAT', 'LON']])
route13 = nx.shortest_path_length(G, origin_node_0, destination_node_13, weight='length')
destination_node_14 = ox.get_nearest_node(G, destinations.loc[14,['LAT', 'LON']])
route14 = nx.shortest_path_length(G, origin_node_0, destination_node_14, weight='length')
destination_node_15 = ox.get_nearest_node(G, destinations.loc[15,['LAT', 'LON']])
route15 = nx.shortest_path_length(G, origin_node_0, destination_node_15, weight='length')
destination_node_16 = ox.get_nearest_node(G, destinations.loc[16, ['LAT', 'LON']])
route16 = nx.shortest_path_length(G, origin_node_0, destination_node_16, weight='length')
destination_node_17 = ox.get_nearest_node(G, destinations.loc[17, ['LAT', 'LON']])
route17 = nx.shortest_path_length(G, origin_node_0, destination_node_17, weight='length')
destination_node_18 = ox.get_nearest_node(G, destinations.loc[18, ['LAT', 'LON']])
route18 = nx.shortest_path_length(G, origin_node_0, destination_node_18, weight='length')
destination_node_19 = ox.get_nearest_node(G, destinations.loc[19, ['LAT', 'LON']])
route19 = nx.shortest_path_length(G, origin_node_0, destination_node_19, weight='length')
destination_node_20 = ox.get_nearest_node(G, destinations.loc[20,['LAT', 'LON']])
route20 = nx.shortest_path_length(G, origin_node_0, destination_node_20, weight='length')
destination_node_21 = ox.get_nearest_node(G, destinations.loc[21,['LAT', 'LON']])
route21 = nx.shortest_path_length(G, origin_node_0, destination_node_21, weight='length')
destination_node_22 = ox.get_nearest_node(G, destinations.loc[22,['LAT', 'LON']])
route22 = nx.shortest_path_length(G, origin_node_0, destination_node_22, weight='length')
destination_node_23 = ox.get_nearest_node(G, destinations.loc[23,['LAT', 'LON']])
route23 = nx.shortest_path_length(G, origin_node_0, destination_node_23, weight='length')
destination_node_24 = ox.get_nearest_node(G, destinations.loc[24,['LAT', 'LON']])
route24 = nx.shortest_path_length(G, origin_node_0, destination_node_24, weight='length')
destination_node_25 = ox.get_nearest_node(G, destinations.loc[25,['LAT', 'LON']])
route25 = nx.shortest_path_length(G, origin_node_0, destination_node_25, weight='length')
destination_node_26 = ox.get_nearest_node(G, destinations.loc[26,['LAT', 'LON']])
route26 = nx.shortest_path_length(G, origin_node_0, destination_node_26, weight='length')
destination_node_27 = ox.get_nearest_node(G, destinations.loc[27,['LAT', 'LON']])
route27 = nx.shortest_path_length(G, origin_node_0, destination_node_27, weight='length')
destination_node_28 = ox.get_nearest_node(G, destinations.loc[28,['LAT', 'LON']])
route28 = nx.shortest_path_length(G, origin_node_0, destination_node_28, weight='length')
destination_node_29 = ox.get_nearest_node(G, destinations.loc[29,['LAT', 'LON']])
route29 = nx.shortest_path_length(G, origin_node_0, destination_node_29, weight='length')
destination_node_30 = ox.get_nearest_node(G, destinations.loc[30,['LAT', 'LON']])
route30 = nx.shortest_path_length(G, origin_node_0, destination_node_30, weight='length')
destination_node_31 = ox.get_nearest_node(G, destinations.loc[31, ['LAT', 'LON']])
route31 = nx.shortest_path_length(G, origin_node_0, destination_node_31, weight='length')
destination_node_32 = ox.get_nearest_node(G, destinations.loc[32, ['LAT', 'LON']])
route32 = nx.shortest_path_length(G, origin_node_0, destination_node_32, weight='length')
destination_node_33 = ox.get_nearest_node(G, destinations.loc[33, ['LAT', 'LON']])
route33 = nx.shortest_path_length(G, origin_node_0, destination_node_33, weight='length')
destination_node_34 = ox.get_nearest_node(G, destinations.loc[34,['LAT', 'LON']])
route34 = nx.shortest_path_length(G, origin_node_0, destination_node_34, weight='length')
destination_node_35 = ox.get_nearest_node(G, destinations.loc[35,['LAT', 'LON']])
route35 = nx.shortest_path_length(G, origin_node_0, destination_node_35, weight='length')
destination_node_36 = ox.get_nearest_node(G, destinations.loc[36,['LAT', 'LON']])
route36 = nx.shortest_path_length(G, origin_node_0, destination_node_36, weight='length')
destination_node_37 = ox.get_nearest_node(G, destinations.loc[37,['LAT', 'LON']])
route37 = nx.shortest_path_length(G, origin_node_0, destination_node_37, weight='length')
destination_node_38 = ox.get_nearest_node(G, destinations.loc[38,['LAT', 'LON']])
route38 = nx.shortest_path_length(G, origin_node_0, destination_node_38, weight='length')
destination_node_39 = ox.get_nearest_node(G, destinations.loc[39,['LAT', 'LON']])
route39 = nx.shortest_path_length(G, origin_node_0, destination_node_39, weight='length')
destination_node_40 = ox.get_nearest_node(G, destinations.loc[40,['LAT', 'LON']])
route40 = nx.shortest_path_length(G, origin_node_0, destination_node_40, weight='length')
destination_node_41 = ox.get_nearest_node(G, destinations.loc[41,['LAT', 'LON']])
route41 = nx.shortest_path_length(G, origin_node_0, destination_node_41, weight='length')
destination_node_42 = ox.get_nearest_node(G, destinations.loc[42,['LAT', 'LON']])
route42 = nx.shortest_path_length(G, origin_node_0, destination_node_42, weight='length')
destination_node_43 = ox.get_nearest_node(G, destinations.loc[43,['LAT', 'LON']])
route43 = nx.shortest_path_length(G, origin_node_0, destination_node_43, weight='length')
destination_node_44 = ox.get_nearest_node(G, destinations.loc[44,['LAT', 'LON']])
route44 = nx.shortest_path_length(G, origin_node_0, destination_node_44, weight='length')
destination_node_45 = ox.get_nearest_node(G, destinations.loc[45,['LAT', 'LON']])
route45 = nx.shortest_path_length(G, origin_node_0, destination_node_45, weight='length')
destination_node_46 = ox.get_nearest_node(G, destinations.loc[46, ['LAT', 'LON']])
route46 = nx.shortest_path_length(G, origin_node_0, destination_node_46, weight='length')
destination_node_47 = ox.get_nearest_node(G, destinations.loc[47, ['LAT', 'LON']])
route47 = nx.shortest_path_length(G, origin_node_0, destination_node_47, weight='length')
destination_node_48 = ox.get_nearest_node(G, destinations.loc[48, ['LAT', 'LON']])
route48 = nx.shortest_path_length(G, origin_node_0, destination_node_48, weight='length')
destination_node_49 = ox.get_nearest_node(G, destinations.loc[49, ['LAT', 'LON']])
route49 = nx.shortest_path_length(G, origin_node_0, destination_node_49, weight='length')
destination_node_50 = ox.get_nearest_node(G, destinations.loc[50, ['LAT', 'LON']])
route50 = nx.shortest_path_length(G, origin_node_0, destination_node_50, weight='length')
destination_node_51 = ox.get_nearest_node(G, destinations.loc[51, ['LAT', 'LON']])
route51 = nx.shortest_path_length(G, origin_node_0, destination_node_51, weight='length')
destination_node_52 = ox.get_nearest_node(G, destinations.loc[52, ['LAT', 'LON']])
route52 = nx.shortest_path_length(G, origin_node_0, destination_node_52, weight='length')
destination_node_53 = ox.get_nearest_node(G, destinations.loc[53, ['LAT', 'LON']])
route53 = nx.shortest_path_length(G, origin_node_0, destination_node_53, weight='length')
destination_node_54 = ox.get_nearest_node(G, destinations.loc[54,['LAT', 'LON']])
route54 = nx.shortest_path_length(G, origin_node_0, destination_node_54, weight='length')
destination_node_55 = ox.get_nearest_node(G, destinations.loc[55,['LAT', 'LON']])
route55 = nx.shortest_path_length(G, origin_node_0, destination_node_55, weight='length')
destination_node_56 = ox.get_nearest_node(G, destinations.loc[56,['LAT', 'LON']])
route56 = nx.shortest_path_length(G, origin_node_0, destination_node_56, weight='length')
destination_node_57 = ox.get_nearest_node(G, destinations.loc[57,['LAT', 'LON']])
route57 = nx.shortest_path_length(G, origin_node_0, destination_node_57, weight='length')
destination_node_58 = ox.get_nearest_node(G, destinations.loc[58,['LAT', 'LON']])
route58 = nx.shortest_path_length(G, origin_node_0, destination_node_58, weight='length')
destination_node_59 = ox.get_nearest_node(G, destinations.loc[59,['LAT', 'LON']])
route59 = nx.shortest_path_length(G, origin_node_0, destination_node_59, weight='length')
destination_node_60 = ox.get_nearest_node(G, destinations.loc[60,['LAT', 'LON']])
route60 = nx.shortest_path_length(G, origin_node_0, destination_node_60, weight='length')
destination_node_61 = ox.get_nearest_node(G, destinations.loc[61,['LAT', 'LON']])
route61 = nx.shortest_path_length(G, origin_node_0, destination_node_61, weight='length')
destination_node_62 = ox.get_nearest_node(G, destinations.loc[62,['LAT', 'LON']])
route62 = nx.shortest_path_length(G, origin_node_0, destination_node_62, weight='length')
destination_node_63 = ox.get_nearest_node(G, destinations.loc[63,['LAT', 'LON']])
route63 = nx.shortest_path_length(G, origin_node_0, destination_node_63, weight='length')
destination_node_64 = ox.get_nearest_node(G, destinations.loc[64,['LAT', 'LON']])
route64 = nx.shortest_path_length(G, origin_node_0, destination_node_64, weight='length')
destination_node_65 = ox.get_nearest_node(G, destinations.loc[65,['LAT', 'LON']])
route65 = nx.shortest_path_length(G, origin_node_0, destination_node_65, weight='length')
destination_node_66 = ox.get_nearest_node(G, destinations.loc[66, ['LAT', 'LON']])
route66 = nx.shortest_path_length(G, origin_node_0, destination_node_66, weight='length')
destination_node_67 = ox.get_nearest_node(G, destinations.loc[67, ['LAT', 'LON']])
route67 = nx.shortest_path_length(G, origin_node_0, destination_node_67, weight='length')
destination_node_68 = ox.get_nearest_node(G, destinations.loc[68, ['LAT', 'LON']])
route68 = nx.shortest_path_length(G, origin_node_0, destination_node_68, weight='length')
destination_node_69 = ox.get_nearest_node(G, destinations.loc[69, ['LAT', 'LON']])
route69 = nx.shortest_path_length(G, origin_node_0, destination_node_69, weight='length')
destination_node_70 = ox.get_nearest_node(G, destinations.loc[70,['LAT', 'LON']])
route70 = nx.shortest_path_length(G, origin_node_0, destination_node_70, weight='length')
destination_node_71 = ox.get_nearest_node(G, destinations.loc[71,['LAT', 'LON']])
route71 = nx.shortest_path_length(G, origin_node_0, destination_node_71, weight='length')
destination_node_72 = ox.get_nearest_node(G, destinations.loc[72,['LAT', 'LON']])
route72 = nx.shortest_path_length(G, origin_node_0, destination_node_72, weight='length')
destination_node_73 = ox.get_nearest_node(G, destinations.loc[73,['LAT', 'LON']])
route73 = nx.shortest_path_length(G, origin_node_0, destination_node_73, weight='length')
destination_node_74 = ox.get_nearest_node(G, destinations.loc[74,['LAT', 'LON']])
route74 = nx.shortest_path_length(G, origin_node_0, destination_node_74, weight='length')
destination_node_75 = ox.get_nearest_node(G, destinations.loc[75,['LAT', 'LON']])
route75 = nx.shortest_path_length(G, origin_node_0, destination_node_75, weight='length')
destination_node_76 = ox.get_nearest_node(G, destinations.loc[76,['LAT', 'LON']])
route76 = nx.shortest_path_length(G, origin_node_0, destination_node_76, weight='length')
destination_node_77 = ox.get_nearest_node(G, destinations.loc[77,['LAT', 'LON']])
route77 = nx.shortest_path_length(G, origin_node_0, destination_node_77, weight='length')
destination_node_78 = ox.get_nearest_node(G, destinations.loc[78,['LAT', 'LON']])
route78 = nx.shortest_path_length(G, origin_node_0, destination_node_78, weight='length')
destination_node_79 = ox.get_nearest_node(G, destinations.loc[79,['LAT', 'LON']])
route79 = nx.shortest_path_length(G, origin_node_0, destination_node_79, weight='length')
destination_node_80 = ox.get_nearest_node(G, destinations.loc[80,['LAT', 'LON']])
route80 = nx.shortest_path_length(G, origin_node_0, destination_node_80, weight='length')
destination_node_81 = ox.get_nearest_node(G, destinations.loc[81, ['LAT', 'LON']])
route81 = nx.shortest_path_length(G, origin_node_0, destination_node_81, weight='length')
destination_node_82 = ox.get_nearest_node(G, destinations.loc[82, ['LAT', 'LON']])
route82 = nx.shortest_path_length(G, origin_node_0, destination_node_82, weight='length')
destination_node_83 = ox.get_nearest_node(G, destinations.loc[83, ['LAT', 'LON']])
route83 = nx.shortest_path_length(G, origin_node_0, destination_node_83, weight='length')
destination_node_84 = ox.get_nearest_node(G, destinations.loc[84,['LAT', 'LON']])
route84 = nx.shortest_path_length(G, origin_node_0, destination_node_84, weight='length')
destination_node_85 = ox.get_nearest_node(G, destinations.loc[85,['LAT', 'LON']])
route85 = nx.shortest_path_length(G, origin_node_0, destination_node_85, weight='length')
destination_node_86 = ox.get_nearest_node(G, destinations.loc[86,['LAT', 'LON']])
route86 = nx.shortest_path_length(G, origin_node_0, destination_node_86, weight='length')
destination_node_87 = ox.get_nearest_node(G, destinations.loc[87,['LAT', 'LON']])
route87 = nx.shortest_path_length(G, origin_node_0, destination_node_87, weight='length')
destination_node_88 = ox.get_nearest_node(G, destinations.loc[88,['LAT', 'LON']])
route88 = nx.shortest_path_length(G, origin_node_0, destination_node_88, weight='length')
destination_node_89 = ox.get_nearest_node(G, destinations.loc[89,['LAT', 'LON']])
route89 = nx.shortest_path_length(G, origin_node_0, destination_node_89, weight='length')
destination_node_90 = ox.get_nearest_node(G, destinations.loc[90,['LAT', 'LON']])
route90 = nx.shortest_path_length(G, origin_node_0, destination_node_90, weight='length')
destination_node_91 = ox.get_nearest_node(G, destinations.loc[91,['LAT', 'LON']])
route91 = nx.shortest_path_length(G, origin_node_0, destination_node_91, weight='length')
destination_node_92 = ox.get_nearest_node(G, destinations.loc[92,['LAT', 'LON']])
route92 = nx.shortest_path_length(G, origin_node_0, destination_node_92, weight='length')
destination_node_93 = ox.get_nearest_node(G, destinations.loc[93,['LAT', 'LON']])
route93 = nx.shortest_path_length(G, origin_node_0, destination_node_93, weight='length')
destination_node_94 = ox.get_nearest_node(G, destinations.loc[94,['LAT', 'LON']])
route94 = nx.shortest_path_length(G, origin_node_0, destination_node_94, weight='length')
destination_node_95 = ox.get_nearest_node(G, destinations.loc[95,['LAT', 'LON']])
route95 = nx.shortest_path_length(G, origin_node_0, destination_node_95, weight='length')
destination_node_96 = ox.get_nearest_node(G, destinations.loc[96, ['LAT', 'LON']])
route96 = nx.shortest_path_length(G, origin_node_0, destination_node_96, weight='length')
destination_node_97 = ox.get_nearest_node(G, destinations.loc[97, ['LAT', 'LON']])
route97 = nx.shortest_path_length(G, origin_node_0, destination_node_97, weight='length')
destination_node_98 = ox.get_nearest_node(G, destinations.loc[98, ['LAT', 'LON']])
route98 = nx.shortest_path_length(G, origin_node_0, destination_node_98, weight='length')
destination_node_99 = ox.get_nearest_node(G, destinations.loc[99, ['LAT', 'LON']])
route99 = nx.shortest_path_length(G, origin_node_0, destination_node_99, weight='length')
destination_node_100 = ox.get_nearest_node(G, destinations.loc[100, ['LAT', 'LON']])
route100 = nx.shortest_path_length(G, origin_node_0, destination_node_100, weight='length')
destination_node_101 = ox.get_nearest_node(G, destinations.loc[101, ['LAT', 'LON']])
route101 = nx.shortest_path_length(G, origin_node_0, destination_node_101, weight='length')
destination_node_102 = ox.get_nearest_node(G, destinations.loc[102, ['LAT', 'LON']])
route102 = nx.shortest_path_length(G, origin_node_0, destination_node_102, weight='length')
destination_node_103 = ox.get_nearest_node(G, destinations.loc[103, ['LAT', 'LON']])
route103 = nx.shortest_path_length(G, origin_node_0, destination_node_103, weight='length')
destination_node_104 = ox.get_nearest_node(G, destinations.loc[104,['LAT', 'LON']])
route104 = nx.shortest_path_length(G, origin_node_0, destination_node_104, weight='length')
destination_node_105 = ox.get_nearest_node(G, destinations.loc[105,['LAT', 'LON']])
route105 = nx.shortest_path_length(G, origin_node_0, destination_node_105, weight='length')
destination_node_106 = ox.get_nearest_node(G, destinations.loc[106,['LAT', 'LON']])
route106 = nx.shortest_path_length(G, origin_node_0, destination_node_106, weight='length')
destination_node_107 = ox.get_nearest_node(G, destinations.loc[107,['LAT', 'LON']])
route107 = nx.shortest_path_length(G, origin_node_0, destination_node_107, weight='length')
destination_node_108 = ox.get_nearest_node(G, destinations.loc[108,['LAT', 'LON']])
route108 = nx.shortest_path_length(G, origin_node_0, destination_node_108, weight='length')
destination_node_109 = ox.get_nearest_node(G, destinations.loc[109,['LAT', 'LON']])
route109 = nx.shortest_path_length(G, origin_node_0, destination_node_109, weight='length')
destination_node_110 = ox.get_nearest_node(G, destinations.loc[110,['LAT', 'LON']])
route110 = nx.shortest_path_length(G, origin_node_0, destination_node_110, weight='length')
destination_node_111 = ox.get_nearest_node(G, destinations.loc[111,['LAT', 'LON']])
route111 = nx.shortest_path_length(G, origin_node_0, destination_node_111, weight='length')
destination_node_112 = ox.get_nearest_node(G, destinations.loc[112,['LAT', 'LON']])
route112 = nx.shortest_path_length(G, origin_node_0, destination_node_112, weight='length')
destination_node_113 = ox.get_nearest_node(G, destinations.loc[113,['LAT', 'LON']])
route113 = nx.shortest_path_length(G, origin_node_0, destination_node_113, weight='length')
destination_node_114 = ox.get_nearest_node(G, destinations.loc[114,['LAT', 'LON']])
route114 = nx.shortest_path_length(G, origin_node_0, destination_node_114, weight='length')
destination_node_115 = ox.get_nearest_node(G, destinations.loc[115,['LAT', 'LON']])
route115 = nx.shortest_path_length(G, origin_node_0, destination_node_115, weight='length')
destination_node_116 = ox.get_nearest_node(G, destinations.loc[116, ['LAT', 'LON']])
route116 = nx.shortest_path_length(G, origin_node_0, destination_node_116, weight='length')
destination_node_117 = ox.get_nearest_node(G, destinations.loc[117, ['LAT', 'LON']])
route117 = nx.shortest_path_length(G, origin_node_0, destination_node_117, weight='length')
destination_node_118 = ox.get_nearest_node(G, destinations.loc[118, ['LAT', 'LON']])
route118 = nx.shortest_path_length(G, origin_node_0, destination_node_118, weight='length')
destination_node_119 = ox.get_nearest_node(G, destinations.loc[119, ['LAT', 'LON']])
route119 = nx.shortest_path_length(G, origin_node_0, destination_node_119, weight='length')
destination_node_120 = ox.get_nearest_node(G, destinations.loc[120,['LAT', 'LON']])
route120 = nx.shortest_path_length(G, origin_node_0, destination_node_120, weight='length')
destination_node_121 = ox.get_nearest_node(G, destinations.loc[121,['LAT', 'LON']])
route121 = nx.shortest_path_length(G, origin_node_0, destination_node_121, weight='length')
destination_node_122 = ox.get_nearest_node(G, destinations.loc[122,['LAT', 'LON']])
route122 = nx.shortest_path_length(G, origin_node_0, destination_node_122, weight='length')
destination_node_123 = ox.get_nearest_node(G, destinations.loc[123,['LAT', 'LON']])
route123 = nx.shortest_path_length(G, origin_node_0, destination_node_123, weight='length')
destination_node_124 = ox.get_nearest_node(G, destinations.loc[124,['LAT', 'LON']])
route124 = nx.shortest_path_length(G, origin_node_0, destination_node_124, weight='length')
destination_node_125 = ox.get_nearest_node(G, destinations.loc[125,['LAT', 'LON']])
route125 = nx.shortest_path_length(G, origin_node_0, destination_node_125, weight='length')
destination_node_126 = ox.get_nearest_node(G, destinations.loc[126,['LAT', 'LON']])
route126 = nx.shortest_path_length(G, origin_node_0, destination_node_126, weight='length')
destination_node_127 = ox.get_nearest_node(G, destinations.loc[127,['LAT', 'LON']])
route127 = nx.shortest_path_length(G, origin_node_0, destination_node_127, weight='length')
destination_node_128 = ox.get_nearest_node(G, destinations.loc[128,['LAT', 'LON']])
route128 = nx.shortest_path_length(G, origin_node_0, destination_node_128, weight='length')
destination_node_129 = ox.get_nearest_node(G, destinations.loc[129,['LAT', 'LON']])
route129 = nx.shortest_path_length(G, origin_node_0, destination_node_129, weight='length')
destination_node_130 = ox.get_nearest_node(G, destinations.loc[130,['LAT', 'LON']])
route130 = nx.shortest_path_length(G, origin_node_0, destination_node_130, weight='length')
destination_node_131 = ox.get_nearest_node(G, destinations.loc[131, ['LAT', 'LON']])
route131 = nx.shortest_path_length(G, origin_node_0, destination_node_131, weight='length')
destination_node_132 = ox.get_nearest_node(G, destinations.loc[132, ['LAT', 'LON']])
route132 = nx.shortest_path_length(G, origin_node_0, destination_node_132, weight='length')
destination_node_133 = ox.get_nearest_node(G, destinations.loc[133, ['LAT', 'LON']])
route133 = nx.shortest_path_length(G, origin_node_0, destination_node_133, weight='length')
destination_node_134 = ox.get_nearest_node(G, destinations.loc[134,['LAT', 'LON']])
route134 = nx.shortest_path_length(G, origin_node_0, destination_node_134, weight='length')
destination_node_135 = ox.get_nearest_node(G, destinations.loc[135,['LAT', 'LON']])
route135 = nx.shortest_path_length(G, origin_node_0, destination_node_135, weight='length')
destination_node_136 = ox.get_nearest_node(G, destinations.loc[136,['LAT', 'LON']])
route136 = nx.shortest_path_length(G, origin_node_0, destination_node_136, weight='length')
destination_node_137 = ox.get_nearest_node(G, destinations.loc[137,['LAT', 'LON']])
route137 = nx.shortest_path_length(G, origin_node_0, destination_node_137, weight='length')
destination_node_138 = ox.get_nearest_node(G, destinations.loc[138,['LAT', 'LON']])
route138 = nx.shortest_path_length(G, origin_node_0, destination_node_138, weight='length')
destination_node_139 = ox.get_nearest_node(G, destinations.loc[139,['LAT', 'LON']])
route139 = nx.shortest_path_length(G, origin_node_0, destination_node_139, weight='length')
destination_node_140 = ox.get_nearest_node(G, destinations.loc[140,['LAT', 'LON']])
route140 = nx.shortest_path_length(G, origin_node_0, destination_node_140, weight='length')
destination_node_141 = ox.get_nearest_node(G, destinations.loc[141,['LAT', 'LON']])
route141 = nx.shortest_path_length(G, origin_node_0, destination_node_141, weight='length')
destination_node_142 = ox.get_nearest_node(G, destinations.loc[142,['LAT', 'LON']])
route142 = nx.shortest_path_length(G, origin_node_0, destination_node_142, weight='length')
destination_node_143 = ox.get_nearest_node(G, destinations.loc[143,['LAT', 'LON']])
route143 = nx.shortest_path_length(G, origin_node_0, destination_node_143, weight='length')
destination_node_144 = ox.get_nearest_node(G, destinations.loc[144,['LAT', 'LON']])
route144 = nx.shortest_path_length(G, origin_node_0, destination_node_144, weight='length')
destination_node_145 = ox.get_nearest_node(G, destinations.loc[145,['LAT', 'LON']])
route145 = nx.shortest_path_length(G, origin_node_0, destination_node_145, weight='length')
destination_node_146 = ox.get_nearest_node(G, destinations.loc[146, ['LAT', 'LON']])
route146 = nx.shortest_path_length(G, origin_node_0, destination_node_146, weight='length')
destination_node_147 = ox.get_nearest_node(G, destinations.loc[147, ['LAT', 'LON']])
route147 = nx.shortest_path_length(G, origin_node_0, destination_node_147, weight='length')
destination_node_148 = ox.get_nearest_node(G, destinations.loc[148, ['LAT', 'LON']])
route148 = nx.shortest_path_length(G, origin_node_0, destination_node_148, weight='length')
destination_node_149 = ox.get_nearest_node(G, destinations.loc[149, ['LAT', 'LON']])
route149 = nx.shortest_path_length(G, origin_node_0, destination_node_149, weight='length')
destination_node_150 = ox.get_nearest_node(G, destinations.loc[150, ['LAT', 'LON']])
route150 = nx.shortest_path_length(G, origin_node_0, destination_node_150, weight='length')
destination_node_151 = ox.get_nearest_node(G, destinations.loc[151, ['LAT', 'LON']])
route151 = nx.shortest_path_length(G, origin_node_0, destination_node_151, weight='length')
destination_node_152 = ox.get_nearest_node(G, destinations.loc[152, ['LAT', 'LON']])
route152 = nx.shortest_path_length(G, origin_node_0, destination_node_152, weight='length')
destination_node_153 = ox.get_nearest_node(G, destinations.loc[153, ['LAT', 'LON']])
route153 = nx.shortest_path_length(G, origin_node_0, destination_node_153, weight='length')
destination_node_154 = ox.get_nearest_node(G, destinations.loc[154,['LAT', 'LON']])
route154 = nx.shortest_path_length(G, origin_node_0, destination_node_154, weight='length')
destination_node_155 = ox.get_nearest_node(G, destinations.loc[155,['LAT', 'LON']])
route155 = nx.shortest_path_length(G, origin_node_0, destination_node_155, weight='length')
destination_node_156 = ox.get_nearest_node(G, destinations.loc[156,['LAT', 'LON']])
route156 = nx.shortest_path_length(G, origin_node_0, destination_node_156, weight='length')
destination_node_157 = ox.get_nearest_node(G, destinations.loc[157,['LAT', 'LON']])
route157 = nx.shortest_path_length(G, origin_node_0, destination_node_157, weight='length')
destination_node_158 = ox.get_nearest_node(G, destinations.loc[158,['LAT', 'LON']])
route158 = nx.shortest_path_length(G, origin_node_0, destination_node_158, weight='length')
destination_node_159 = ox.get_nearest_node(G, destinations.loc[159,['LAT', 'LON']])
route159 = nx.shortest_path_length(G, origin_node_0, destination_node_159, weight='length')
destination_node_160 = ox.get_nearest_node(G, destinations.loc[160,['LAT', 'LON']])
route160 = nx.shortest_path_length(G, origin_node_0, destination_node_160, weight='length')
destination_node_161 = ox.get_nearest_node(G, destinations.loc[161,['LAT', 'LON']])
route161 = nx.shortest_path_length(G, origin_node_0, destination_node_161, weight='length')
destination_node_162 = ox.get_nearest_node(G, destinations.loc[162,['LAT', 'LON']])
route162 = nx.shortest_path_length(G, origin_node_0, destination_node_162, weight='length')
destination_node_163 = ox.get_nearest_node(G, destinations.loc[163,['LAT', 'LON']])
route163 = nx.shortest_path_length(G, origin_node_0, destination_node_163, weight='length')
destination_node_164 = ox.get_nearest_node(G, destinations.loc[164,['LAT', 'LON']])
route164 = nx.shortest_path_length(G, origin_node_0, destination_node_164, weight='length')
destination_node_165 = ox.get_nearest_node(G, destinations.loc[165,['LAT', 'LON']])
route165 = nx.shortest_path_length(G, origin_node_0, destination_node_165, weight='length')
destination_node_166 = ox.get_nearest_node(G, destinations.loc[166, ['LAT', 'LON']])
route166 = nx.shortest_path_length(G, origin_node_0, destination_node_166, weight='length')
destination_node_167 = ox.get_nearest_node(G, destinations.loc[167, ['LAT', 'LON']])
route167 = nx.shortest_path_length(G, origin_node_0, destination_node_167, weight='length')
destination_node_168 = ox.get_nearest_node(G, destinations.loc[168, ['LAT', 'LON']])
route168 = nx.shortest_path_length(G, origin_node_0, destination_node_168, weight='length')
destination_node_169 = ox.get_nearest_node(G, destinations.loc[169, ['LAT', 'LON']])
route169 = nx.shortest_path_length(G, origin_node_0, destination_node_169, weight='length')
destination_node_170 = ox.get_nearest_node(G, destinations.loc[170,['LAT', 'LON']])
route170 = nx.shortest_path_length(G, origin_node_0, destination_node_170, weight='length')
destination_node_171 = ox.get_nearest_node(G, destinations.loc[171,['LAT', 'LON']])
route171 = nx.shortest_path_length(G, origin_node_0, destination_node_171, weight='length')
destination_node_172 = ox.get_nearest_node(G, destinations.loc[172,['LAT', 'LON']])
route172 = nx.shortest_path_length(G, origin_node_0, destination_node_172, weight='length')
destination_node_173 = ox.get_nearest_node(G, destinations.loc[173,['LAT', 'LON']])
route173 = nx.shortest_path_length(G, origin_node_0, destination_node_173, weight='length')
destination_node_174 = ox.get_nearest_node(G, destinations.loc[174,['LAT', 'LON']])
route174 = nx.shortest_path_length(G, origin_node_0, destination_node_174, weight='length')
destination_node_175 = ox.get_nearest_node(G, destinations.loc[175,['LAT', 'LON']])
route175 = nx.shortest_path_length(G, origin_node_0, destination_node_175, weight='length')
destination_node_176 = ox.get_nearest_node(G, destinations.loc[176,['LAT', 'LON']])
route176 = nx.shortest_path_length(G, origin_node_0, destination_node_176, weight='length')
destination_node_177 = ox.get_nearest_node(G, destinations.loc[177,['LAT', 'LON']])
route177 = nx.shortest_path_length(G, origin_node_0, destination_node_177, weight='length')
destination_node_178 = ox.get_nearest_node(G, destinations.loc[178,['LAT', 'LON']])
route178 = nx.shortest_path_length(G, origin_node_0, destination_node_178, weight='length')
destination_node_179 = ox.get_nearest_node(G, destinations.loc[179,['LAT', 'LON']])
route179 = nx.shortest_path_length(G, origin_node_0, destination_node_179, weight='length')
destination_node_180 = ox.get_nearest_node(G, destinations.loc[180,['LAT', 'LON']])
route180 = nx.shortest_path_length(G, origin_node_0, destination_node_180, weight='length')
destination_node_181 = ox.get_nearest_node(G, destinations.loc[181, ['LAT', 'LON']])
route181 = nx.shortest_path_length(G, origin_node_0, destination_node_181, weight='length')
destination_node_182 = ox.get_nearest_node(G, destinations.loc[182, ['LAT', 'LON']])
route182 = nx.shortest_path_length(G, origin_node_0, destination_node_182, weight='length')
destination_node_183 = ox.get_nearest_node(G, destinations.loc[183, ['LAT', 'LON']])
route183 = nx.shortest_path_length(G, origin_node_0, destination_node_183, weight='length')
destination_node_184 = ox.get_nearest_node(G, destinations.loc[184,['LAT', 'LON']])
route184 = nx.shortest_path_length(G, origin_node_0, destination_node_184, weight='length')
destination_node_185 = ox.get_nearest_node(G, destinations.loc[185,['LAT', 'LON']])
route185 = nx.shortest_path_length(G, origin_node_0, destination_node_185, weight='length')
destination_node_186 = ox.get_nearest_node(G, destinations.loc[186,['LAT', 'LON']])
route186 = nx.shortest_path_length(G, origin_node_0, destination_node_186, weight='length')
destination_node_187 = ox.get_nearest_node(G, destinations.loc[187,['LAT', 'LON']])
route187 = nx.shortest_path_length(G, origin_node_0, destination_node_187, weight='length')
destination_node_188 = ox.get_nearest_node(G, destinations.loc[188,['LAT', 'LON']])
route188 = nx.shortest_path_length(G, origin_node_0, destination_node_188, weight='length')
destination_node_189 = ox.get_nearest_node(G, destinations.loc[189,['LAT', 'LON']])
route189 = nx.shortest_path_length(G, origin_node_0, destination_node_189, weight='length')
destination_node_190 = ox.get_nearest_node(G, destinations.loc[190,['LAT', 'LON']])
route190 = nx.shortest_path_length(G, origin_node_0, destination_node_190, weight='length')
destination_node_191 = ox.get_nearest_node(G, destinations.loc[191,['LAT', 'LON']])
route191 = nx.shortest_path_length(G, origin_node_0, destination_node_191, weight='length')
destination_node_192 = ox.get_nearest_node(G, destinations.loc[192,['LAT', 'LON']])
route192 = nx.shortest_path_length(G, origin_node_0, destination_node_192, weight='length')
destination_node_193 = ox.get_nearest_node(G, destinations.loc[193,['LAT', 'LON']])
route193 = nx.shortest_path_length(G, origin_node_0, destination_node_193, weight='length')
destination_node_194 = ox.get_nearest_node(G, destinations.loc[194,['LAT', 'LON']])
route194 = nx.shortest_path_length(G, origin_node_0, destination_node_194, weight='length')
destination_node_195 = ox.get_nearest_node(G, destinations.loc[195,['LAT', 'LON']])
route195 = nx.shortest_path_length(G, origin_node_0, destination_node_195, weight='length')
destination_node_196 = ox.get_nearest_node(G, destinations.loc[196, ['LAT', 'LON']])
route196 = nx.shortest_path_length(G, origin_node_0, destination_node_196, weight='length')
destination_node_197 = ox.get_nearest_node(G, destinations.loc[197, ['LAT', 'LON']])
route197 = nx.shortest_path_length(G, origin_node_0, destination_node_197, weight='length')
destination_node_198 = ox.get_nearest_node(G, destinations.loc[198, ['LAT', 'LON']])
route198 = nx.shortest_path_length(G, origin_node_0, destination_node_198, weight='length')
destination_node_199 = ox.get_nearest_node(G, destinations.loc[199, ['LAT', 'LON']])
route199 = nx.shortest_path_length(G, origin_node_0, destination_node_199, weight='length')
destination_node_200 = ox.get_nearest_node(G, destinations.loc[200, ['LAT', 'LON']])
route200 = nx.shortest_path_length(G, origin_node_0, destination_node_200, weight='length')
destination_node_201 = ox.get_nearest_node(G, destinations.loc[201, ['LAT', 'LON']])
route201 = nx.shortest_path_length(G, origin_node_0, destination_node_201, weight='length')
destination_node_202 = ox.get_nearest_node(G, destinations.loc[202, ['LAT', 'LON']])
route202 = nx.shortest_path_length(G, origin_node_0, destination_node_202, weight='length')
destination_node_203 = ox.get_nearest_node(G, destinations.loc[203, ['LAT', 'LON']])
route203 = nx.shortest_path_length(G, origin_node_0, destination_node_203, weight='length')
destination_node_204 = ox.get_nearest_node(G, destinations.loc[204,['LAT', 'LON']])
route204 = nx.shortest_path_length(G, origin_node_0, destination_node_204, weight='length')
destination_node_205 = ox.get_nearest_node(G, destinations.loc[205,['LAT', 'LON']])
route205 = nx.shortest_path_length(G, origin_node_0, destination_node_205, weight='length')
destination_node_206 = ox.get_nearest_node(G, destinations.loc[206,['LAT', 'LON']])
route206 = nx.shortest_path_length(G, origin_node_0, destination_node_206, weight='length')
destination_node_207 = ox.get_nearest_node(G, destinations.loc[207,['LAT', 'LON']])
route207 = nx.shortest_path_length(G, origin_node_0, destination_node_207, weight='length')
destination_node_208 = ox.get_nearest_node(G, destinations.loc[208,['LAT', 'LON']])
route208 = nx.shortest_path_length(G, origin_node_0, destination_node_208, weight='length')
destination_node_209 = ox.get_nearest_node(G, destinations.loc[209,['LAT', 'LON']])
route209 = nx.shortest_path_length(G, origin_node_0, destination_node_209, weight='length')
destination_node_210 = ox.get_nearest_node(G, destinations.loc[210,['LAT', 'LON']])
route210 = nx.shortest_path_length(G, origin_node_0, destination_node_210, weight='length')
destination_node_211 = ox.get_nearest_node(G, destinations.loc[211,['LAT', 'LON']])
route211 = nx.shortest_path_length(G, origin_node_0, destination_node_211, weight='length')
destination_node_212 = ox.get_nearest_node(G, destinations.loc[212,['LAT', 'LON']])
route212 = nx.shortest_path_length(G, origin_node_0, destination_node_212, weight='length')
destination_node_213 = ox.get_nearest_node(G, destinations.loc[213,['LAT', 'LON']])
route213 = nx.shortest_path_length(G, origin_node_0, destination_node_213, weight='length')
destination_node_214 = ox.get_nearest_node(G, destinations.loc[214,['LAT', 'LON']])
route214 = nx.shortest_path_length(G, origin_node_0, destination_node_214, weight='length')
destination_node_215 = ox.get_nearest_node(G, destinations.loc[215,['LAT', 'LON']])
route215 = nx.shortest_path_length(G, origin_node_0, destination_node_215, weight='length')
destination_node_216 = ox.get_nearest_node(G, destinations.loc[216, ['LAT', 'LON']])
route216 = nx.shortest_path_length(G, origin_node_0, destination_node_216, weight='length')
destination_node_217 = ox.get_nearest_node(G, destinations.loc[217, ['LAT', 'LON']])
route217 = nx.shortest_path_length(G, origin_node_0, destination_node_217, weight='length')
destination_node_218 = ox.get_nearest_node(G, destinations.loc[218, ['LAT', 'LON']])
route218 = nx.shortest_path_length(G, origin_node_0, destination_node_218, weight='length')
destination_node_219 = ox.get_nearest_node(G, destinations.loc[219, ['LAT', 'LON']])
route219 = nx.shortest_path_length(G, origin_node_0, destination_node_219, weight='length')
destination_node_220 = ox.get_nearest_node(G, destinations.loc[220,['LAT', 'LON']])
route220 = nx.shortest_path_length(G, origin_node_0, destination_node_220, weight='length')
destination_node_221 = ox.get_nearest_node(G, destinations.loc[221,['LAT', 'LON']])
route221 = nx.shortest_path_length(G, origin_node_0, destination_node_221, weight='length')
destination_node_222 = ox.get_nearest_node(G, destinations.loc[222,['LAT', 'LON']])
route222 = nx.shortest_path_length(G, origin_node_0, destination_node_222, weight='length')
destination_node_223 = ox.get_nearest_node(G, destinations.loc[223,['LAT', 'LON']])
route223 = nx.shortest_path_length(G, origin_node_0, destination_node_223, weight='length')
destination_node_224 = ox.get_nearest_node(G, destinations.loc[224,['LAT', 'LON']])
route224 = nx.shortest_path_length(G, origin_node_0, destination_node_224, weight='length')
destination_node_225 = ox.get_nearest_node(G, destinations.loc[225,['LAT', 'LON']])
route225 = nx.shortest_path_length(G, origin_node_0, destination_node_225, weight='length')
destination_node_226 = ox.get_nearest_node(G, destinations.loc[226,['LAT', 'LON']])
route226 = nx.shortest_path_length(G, origin_node_0, destination_node_226, weight='length')
destination_node_227 = ox.get_nearest_node(G, destinations.loc[227,['LAT', 'LON']])
route227 = nx.shortest_path_length(G, origin_node_0, destination_node_227, weight='length')
destination_node_228 = ox.get_nearest_node(G, destinations.loc[228,['LAT', 'LON']])
route228 = nx.shortest_path_length(G, origin_node_0, destination_node_228, weight='length')
destination_node_229 = ox.get_nearest_node(G, destinations.loc[229,['LAT', 'LON']])
route229 = nx.shortest_path_length(G, origin_node_0, destination_node_229, weight='length')
destination_node_230 = ox.get_nearest_node(G, destinations.loc[230,['LAT', 'LON']])
route230 = nx.shortest_path_length(G, origin_node_0, destination_node_230, weight='length')
destination_node_231 = ox.get_nearest_node(G, destinations.loc[231, ['LAT', 'LON']])
route231 = nx.shortest_path_length(G, origin_node_0, destination_node_231, weight='length')
destination_node_232 = ox.get_nearest_node(G, destinations.loc[232, ['LAT', 'LON']])
route232 = nx.shortest_path_length(G, origin_node_0, destination_node_232, weight='length')
destination_node_233 = ox.get_nearest_node(G, destinations.loc[233, ['LAT', 'LON']])
route233 = nx.shortest_path_length(G, origin_node_0, destination_node_233, weight='length')
destination_node_234 = ox.get_nearest_node(G, destinations.loc[234,['LAT', 'LON']])
route234 = nx.shortest_path_length(G, origin_node_0, destination_node_234, weight='length')
destination_node_235 = ox.get_nearest_node(G, destinations.loc[235,['LAT', 'LON']])
route235 = nx.shortest_path_length(G, origin_node_0, destination_node_235, weight='length')
destination_node_236 = ox.get_nearest_node(G, destinations.loc[236,['LAT', 'LON']])
route236 = nx.shortest_path_length(G, origin_node_0, destination_node_236, weight='length')
destination_node_237 = ox.get_nearest_node(G, destinations.loc[237,['LAT', 'LON']])
route237 = nx.shortest_path_length(G, origin_node_0, destination_node_237, weight='length')
destination_node_238 = ox.get_nearest_node(G, destinations.loc[238,['LAT', 'LON']])
route238 = nx.shortest_path_length(G, origin_node_0, destination_node_238, weight='length')
destination_node_239 = ox.get_nearest_node(G, destinations.loc[239,['LAT', 'LON']])
route239 = nx.shortest_path_length(G, origin_node_0, destination_node_239, weight='length')
destination_node_240 = ox.get_nearest_node(G, destinations.loc[240,['LAT', 'LON']])
route240 = nx.shortest_path_length(G, origin_node_0, destination_node_240, weight='length')
destination_node_241 = ox.get_nearest_node(G, destinations.loc[241,['LAT', 'LON']])
route241 = nx.shortest_path_length(G, origin_node_0, destination_node_241, weight='length')
destination_node_242 = ox.get_nearest_node(G, destinations.loc[242,['LAT', 'LON']])
route242 = nx.shortest_path_length(G, origin_node_0, destination_node_242, weight='length')
destination_node_243 = ox.get_nearest_node(G, destinations.loc[243,['LAT', 'LON']])
route243 = nx.shortest_path_length(G, origin_node_0, destination_node_243, weight='length')
destination_node_244 = ox.get_nearest_node(G, destinations.loc[244,['LAT', 'LON']])
route244 = nx.shortest_path_length(G, origin_node_0, destination_node_244, weight='length')
destination_node_245 = ox.get_nearest_node(G, destinations.loc[245,['LAT', 'LON']])
route245 = nx.shortest_path_length(G, origin_node_0, destination_node_245, weight='length')
destination_node_246 = ox.get_nearest_node(G, destinations.loc[246, ['LAT', 'LON']])
route246 = nx.shortest_path_length(G, origin_node_0, destination_node_246, weight='length')
destination_node_247 = ox.get_nearest_node(G, destinations.loc[247, ['LAT', 'LON']])
route247 = nx.shortest_path_length(G, origin_node_0, destination_node_247, weight='length')
destination_node_248 = ox.get_nearest_node(G, destinations.loc[248, ['LAT', 'LON']])
route248 = nx.shortest_path_length(G, origin_node_0, destination_node_248, weight='length')
destination_node_249 = ox.get_nearest_node(G, destinations.loc[249, ['LAT', 'LON']])
route249 = nx.shortest_path_length(G, origin_node_0, destination_node_249, weight='length')

route, route1, route2, route3, route4, route5, route6, route7, route8, route9, route10, route11, route12, route13, route14,
route15, route16, route17, route18, route19, route20, route21, route22, route23, route24, route25, route26, route27, route28,
route29, route30, route31, route32, route33, route34, route35, route36, route37, route38, route39, route40, route41, route42,
route43, route44, route45, route46, route47, route48, route49, route50, route51, route52, route53, route54, route55, route56,
route57, route58, route59, route60, route61, route62, route63, route64, route65, route66, route67, route68, route69, route70,
route71, route72, route73, route74, route75, route76, route77, route78, route79, route80, route81, route82, route83, route84,
route85, route86, route87, route88, route89, route90, route91, route92, route93, route94, route95, route96, route97, route98,
route99, route100, route101, route102, route103, route104, route105, route106, route107, route108, route109, route110, route111,
route112, route113, route114, route115, route116, route117, route118, route119, route120, route121, route122, route123, route124,
route125, route126, route127, route128, route129, route130, route131, route132, route133, route134, route135, route136, route137,
route137, route138, route139, route140, route141, route142, route143, route144, route145, route146, route147, route148, route149,
route150, route151, route152, route153, route154, route155, route156, route157, route158, route159, route160, route161, route162,
route163, route164, route165, route166, route167, route168, route169, route170, route171, route172, route173, route174, route175,
route176, route177, route178, route179, route180, route181, route182, route183, route184, route185, route186, route187, route188,
route189, route190, route191, route192, route193, route194, route195, route196, route197, route198, route199, route200, route201,
route202, route203, route204, route205, route206, route207, route208, route209, route210, route211, route212, route213, route214,
route215, route216, route217, route218, route219, route220, route221, route222, route223, route224, route225, route226, route227,
route228, route229, route230, route231, route232, route233, route234, route235, route236, route237, route238, route239, route240,
route241, route242, route243, route244, route245, route246, route247, route248, route249

# print mean average
print(statistics.mean([route, route1, route2, route3, route4, route5, route6, route7, route8, route9, route10, route11, route12, route13, route14,
route15, route16, route17, route18, route19, route20, route21, route22, route23, route24, route25, route26, route27, route28,
route29, route30, route31, route32, route33, route34, route35, route36, route37, route38, route39, route40, route41, route42,
route43, route44, route45, route46, route47, route48, route49, route50, route51, route52, route53, route54, route55, route56,
route57, route58, route59, route60, route61, route62, route63, route64, route65, route66, route67, route68, route69, route70,
route71, route72, route73, route74, route75, route76, route77, route78, route79, route80, route81, route82, route83, route84,
route85, route86, route87, route88, route89, route90, route91, route92, route93, route94, route95, route96, route97, route98,
route99, route100, route101, route102, route103, route104, route105, route106, route107, route108, route109, route110, route111,
route112, route113, route114, route115, route116, route117, route118, route119, route120, route121, route122, route123, route124,
route125, route126, route127, route128, route129, route130, route131, route132, route133, route134, route135, route136, route137,
route137, route138, route139, route140, route141, route142, route143, route144, route145, route146, route147, route148, route149,
route150, route151, route152, route153, route154, route155, route156, route157, route158, route159, route160, route161, route162,
route163, route164, route165, route166, route167, route168, route169, route170, route171, route172, route173, route174, route175,
route176, route177, route178, route179, route180, route181, route182, route183, route184, route185, route186, route187, route188,
route189, route190, route191, route192, route193, route194, route195, route196, route197, route198, route199, route200, route201,
route202, route203, route204, route205, route206, route207, route208, route209, route210, route211, route212, route213, route214,
route215, route216, route217, route218, route219, route220, route221, route222, route223, route224, route225, route226, route227,
route228, route229, route230, route231, route232, route233, route234, route235, route236, route237, route238, route239, route240,
route241, route242, route243, route244, route245, route246, route247, route248, route249]))






share|improve this question













I am working on a project to find a contaminated water well that killed 250 people. There are seven water wells in an area.



I would like to compute shortest path lengths from each well to all deaths and calculate mean average of lengths. The well that has smallest mean average would be a candidate as a source of contamination.



Using NetworkX and Osmnx, I was able to create shortest path lengths from each well to 250 deaths. Then, I calculated mean average. I have seven mean average shortest path lengths. The code is repetition of calculation of shortest path lengths from one well to each death 250 times. I was wondering if there is a way to automate it.



import statistics
import networkx as nx
import osmnx as ox
import pandas as pd

ox.config(use_cache=True, log_console=True)
ox.__version__
ox.config(log_file=True, log_console=True, use_cache=True)

# CSV with 250 deaths locations in Latitude and Longitude
destinations = pd.read_csv('resources/destinations.csv')

# CSV with well locations in Latitude and Longitude
origins = pd.read_csv('resources/origins.csv')

# Get graph for a location
COORDINATES = (51.513578, -0.136722)
G = ox.graph_from_point(COORDINATES, network_type='walk')
fig, ax = ox.plot_graph(G)

# Get node for origin 0
origin_node_0 = ox.get_nearest_node(G, origins.loc[0, ['LAT', 'LON']])

# Get nodes for each destination
# Get shortest path length from origin node 0 to destination node 0 through 249

origin_node_0 = ox.get_nearest_node(G, origins.loc[0, ['LAT', 'LON']])

destination_node_0 = ox.get_nearest_node(G, destinations.loc[0, ['LAT', 'LON']])
route = nx.shortest_path_length(G, origin_node_0, destination_node_0, weight='length')
destination_node_1 = ox.get_nearest_node(G, destinations.loc[1, ['LAT', 'LON']])
route1 = nx.shortest_path_length(G, origin_node_0, destination_node_1, weight='length')
destination_node_2 = ox.get_nearest_node(G, destinations.loc[2, ['LAT', 'LON']])
route2 = nx.shortest_path_length(G, origin_node_0, destination_node_2, weight='length')
destination_node_3 = ox.get_nearest_node(G, destinations.loc[3, ['LAT', 'LON']])
route3 = nx.shortest_path_length(G, origin_node_0, destination_node_3, weight='length')
destination_node_4 = ox.get_nearest_node(G, destinations.loc[4,['LAT', 'LON']])
route4 = nx.shortest_path_length(G, origin_node_0, destination_node_4, weight='length')
destination_node_5 = ox.get_nearest_node(G, destinations.loc[5,['LAT', 'LON']])
route5 = nx.shortest_path_length(G, origin_node_0, destination_node_5, weight='length')
destination_node_6 = ox.get_nearest_node(G, destinations.loc[6,['LAT', 'LON']])
route6 = nx.shortest_path_length(G, origin_node_0, destination_node_6, weight='length')
destination_node_7 = ox.get_nearest_node(G, destinations.loc[7,['LAT', 'LON']])
route7 = nx.shortest_path_length(G, origin_node_0, destination_node_7, weight='length')
destination_node_8 = ox.get_nearest_node(G, destinations.loc[8,['LAT', 'LON']])
route8 = nx.shortest_path_length(G, origin_node_0, destination_node_8, weight='length')
destination_node_9 = ox.get_nearest_node(G, destinations.loc[9,['LAT', 'LON']])
route9 = nx.shortest_path_length(G, origin_node_0, destination_node_9, weight='length')
destination_node_10 = ox.get_nearest_node(G, destinations.loc[10,['LAT', 'LON']])
route10 = nx.shortest_path_length(G, origin_node_0, destination_node_10, weight='length')
destination_node_11 = ox.get_nearest_node(G, destinations.loc[11,['LAT', 'LON']])
route11 = nx.shortest_path_length(G, origin_node_0, destination_node_11, weight='length')
destination_node_12 = ox.get_nearest_node(G, destinations.loc[12,['LAT', 'LON']])
route12 = nx.shortest_path_length(G, origin_node_0, destination_node_12, weight='length')
destination_node_13 = ox.get_nearest_node(G, destinations.loc[13,['LAT', 'LON']])
route13 = nx.shortest_path_length(G, origin_node_0, destination_node_13, weight='length')
destination_node_14 = ox.get_nearest_node(G, destinations.loc[14,['LAT', 'LON']])
route14 = nx.shortest_path_length(G, origin_node_0, destination_node_14, weight='length')
destination_node_15 = ox.get_nearest_node(G, destinations.loc[15,['LAT', 'LON']])
route15 = nx.shortest_path_length(G, origin_node_0, destination_node_15, weight='length')
destination_node_16 = ox.get_nearest_node(G, destinations.loc[16, ['LAT', 'LON']])
route16 = nx.shortest_path_length(G, origin_node_0, destination_node_16, weight='length')
destination_node_17 = ox.get_nearest_node(G, destinations.loc[17, ['LAT', 'LON']])
route17 = nx.shortest_path_length(G, origin_node_0, destination_node_17, weight='length')
destination_node_18 = ox.get_nearest_node(G, destinations.loc[18, ['LAT', 'LON']])
route18 = nx.shortest_path_length(G, origin_node_0, destination_node_18, weight='length')
destination_node_19 = ox.get_nearest_node(G, destinations.loc[19, ['LAT', 'LON']])
route19 = nx.shortest_path_length(G, origin_node_0, destination_node_19, weight='length')
destination_node_20 = ox.get_nearest_node(G, destinations.loc[20,['LAT', 'LON']])
route20 = nx.shortest_path_length(G, origin_node_0, destination_node_20, weight='length')
destination_node_21 = ox.get_nearest_node(G, destinations.loc[21,['LAT', 'LON']])
route21 = nx.shortest_path_length(G, origin_node_0, destination_node_21, weight='length')
destination_node_22 = ox.get_nearest_node(G, destinations.loc[22,['LAT', 'LON']])
route22 = nx.shortest_path_length(G, origin_node_0, destination_node_22, weight='length')
destination_node_23 = ox.get_nearest_node(G, destinations.loc[23,['LAT', 'LON']])
route23 = nx.shortest_path_length(G, origin_node_0, destination_node_23, weight='length')
destination_node_24 = ox.get_nearest_node(G, destinations.loc[24,['LAT', 'LON']])
route24 = nx.shortest_path_length(G, origin_node_0, destination_node_24, weight='length')
destination_node_25 = ox.get_nearest_node(G, destinations.loc[25,['LAT', 'LON']])
route25 = nx.shortest_path_length(G, origin_node_0, destination_node_25, weight='length')
destination_node_26 = ox.get_nearest_node(G, destinations.loc[26,['LAT', 'LON']])
route26 = nx.shortest_path_length(G, origin_node_0, destination_node_26, weight='length')
destination_node_27 = ox.get_nearest_node(G, destinations.loc[27,['LAT', 'LON']])
route27 = nx.shortest_path_length(G, origin_node_0, destination_node_27, weight='length')
destination_node_28 = ox.get_nearest_node(G, destinations.loc[28,['LAT', 'LON']])
route28 = nx.shortest_path_length(G, origin_node_0, destination_node_28, weight='length')
destination_node_29 = ox.get_nearest_node(G, destinations.loc[29,['LAT', 'LON']])
route29 = nx.shortest_path_length(G, origin_node_0, destination_node_29, weight='length')
destination_node_30 = ox.get_nearest_node(G, destinations.loc[30,['LAT', 'LON']])
route30 = nx.shortest_path_length(G, origin_node_0, destination_node_30, weight='length')
destination_node_31 = ox.get_nearest_node(G, destinations.loc[31, ['LAT', 'LON']])
route31 = nx.shortest_path_length(G, origin_node_0, destination_node_31, weight='length')
destination_node_32 = ox.get_nearest_node(G, destinations.loc[32, ['LAT', 'LON']])
route32 = nx.shortest_path_length(G, origin_node_0, destination_node_32, weight='length')
destination_node_33 = ox.get_nearest_node(G, destinations.loc[33, ['LAT', 'LON']])
route33 = nx.shortest_path_length(G, origin_node_0, destination_node_33, weight='length')
destination_node_34 = ox.get_nearest_node(G, destinations.loc[34,['LAT', 'LON']])
route34 = nx.shortest_path_length(G, origin_node_0, destination_node_34, weight='length')
destination_node_35 = ox.get_nearest_node(G, destinations.loc[35,['LAT', 'LON']])
route35 = nx.shortest_path_length(G, origin_node_0, destination_node_35, weight='length')
destination_node_36 = ox.get_nearest_node(G, destinations.loc[36,['LAT', 'LON']])
route36 = nx.shortest_path_length(G, origin_node_0, destination_node_36, weight='length')
destination_node_37 = ox.get_nearest_node(G, destinations.loc[37,['LAT', 'LON']])
route37 = nx.shortest_path_length(G, origin_node_0, destination_node_37, weight='length')
destination_node_38 = ox.get_nearest_node(G, destinations.loc[38,['LAT', 'LON']])
route38 = nx.shortest_path_length(G, origin_node_0, destination_node_38, weight='length')
destination_node_39 = ox.get_nearest_node(G, destinations.loc[39,['LAT', 'LON']])
route39 = nx.shortest_path_length(G, origin_node_0, destination_node_39, weight='length')
destination_node_40 = ox.get_nearest_node(G, destinations.loc[40,['LAT', 'LON']])
route40 = nx.shortest_path_length(G, origin_node_0, destination_node_40, weight='length')
destination_node_41 = ox.get_nearest_node(G, destinations.loc[41,['LAT', 'LON']])
route41 = nx.shortest_path_length(G, origin_node_0, destination_node_41, weight='length')
destination_node_42 = ox.get_nearest_node(G, destinations.loc[42,['LAT', 'LON']])
route42 = nx.shortest_path_length(G, origin_node_0, destination_node_42, weight='length')
destination_node_43 = ox.get_nearest_node(G, destinations.loc[43,['LAT', 'LON']])
route43 = nx.shortest_path_length(G, origin_node_0, destination_node_43, weight='length')
destination_node_44 = ox.get_nearest_node(G, destinations.loc[44,['LAT', 'LON']])
route44 = nx.shortest_path_length(G, origin_node_0, destination_node_44, weight='length')
destination_node_45 = ox.get_nearest_node(G, destinations.loc[45,['LAT', 'LON']])
route45 = nx.shortest_path_length(G, origin_node_0, destination_node_45, weight='length')
destination_node_46 = ox.get_nearest_node(G, destinations.loc[46, ['LAT', 'LON']])
route46 = nx.shortest_path_length(G, origin_node_0, destination_node_46, weight='length')
destination_node_47 = ox.get_nearest_node(G, destinations.loc[47, ['LAT', 'LON']])
route47 = nx.shortest_path_length(G, origin_node_0, destination_node_47, weight='length')
destination_node_48 = ox.get_nearest_node(G, destinations.loc[48, ['LAT', 'LON']])
route48 = nx.shortest_path_length(G, origin_node_0, destination_node_48, weight='length')
destination_node_49 = ox.get_nearest_node(G, destinations.loc[49, ['LAT', 'LON']])
route49 = nx.shortest_path_length(G, origin_node_0, destination_node_49, weight='length')
destination_node_50 = ox.get_nearest_node(G, destinations.loc[50, ['LAT', 'LON']])
route50 = nx.shortest_path_length(G, origin_node_0, destination_node_50, weight='length')
destination_node_51 = ox.get_nearest_node(G, destinations.loc[51, ['LAT', 'LON']])
route51 = nx.shortest_path_length(G, origin_node_0, destination_node_51, weight='length')
destination_node_52 = ox.get_nearest_node(G, destinations.loc[52, ['LAT', 'LON']])
route52 = nx.shortest_path_length(G, origin_node_0, destination_node_52, weight='length')
destination_node_53 = ox.get_nearest_node(G, destinations.loc[53, ['LAT', 'LON']])
route53 = nx.shortest_path_length(G, origin_node_0, destination_node_53, weight='length')
destination_node_54 = ox.get_nearest_node(G, destinations.loc[54,['LAT', 'LON']])
route54 = nx.shortest_path_length(G, origin_node_0, destination_node_54, weight='length')
destination_node_55 = ox.get_nearest_node(G, destinations.loc[55,['LAT', 'LON']])
route55 = nx.shortest_path_length(G, origin_node_0, destination_node_55, weight='length')
destination_node_56 = ox.get_nearest_node(G, destinations.loc[56,['LAT', 'LON']])
route56 = nx.shortest_path_length(G, origin_node_0, destination_node_56, weight='length')
destination_node_57 = ox.get_nearest_node(G, destinations.loc[57,['LAT', 'LON']])
route57 = nx.shortest_path_length(G, origin_node_0, destination_node_57, weight='length')
destination_node_58 = ox.get_nearest_node(G, destinations.loc[58,['LAT', 'LON']])
route58 = nx.shortest_path_length(G, origin_node_0, destination_node_58, weight='length')
destination_node_59 = ox.get_nearest_node(G, destinations.loc[59,['LAT', 'LON']])
route59 = nx.shortest_path_length(G, origin_node_0, destination_node_59, weight='length')
destination_node_60 = ox.get_nearest_node(G, destinations.loc[60,['LAT', 'LON']])
route60 = nx.shortest_path_length(G, origin_node_0, destination_node_60, weight='length')
destination_node_61 = ox.get_nearest_node(G, destinations.loc[61,['LAT', 'LON']])
route61 = nx.shortest_path_length(G, origin_node_0, destination_node_61, weight='length')
destination_node_62 = ox.get_nearest_node(G, destinations.loc[62,['LAT', 'LON']])
route62 = nx.shortest_path_length(G, origin_node_0, destination_node_62, weight='length')
destination_node_63 = ox.get_nearest_node(G, destinations.loc[63,['LAT', 'LON']])
route63 = nx.shortest_path_length(G, origin_node_0, destination_node_63, weight='length')
destination_node_64 = ox.get_nearest_node(G, destinations.loc[64,['LAT', 'LON']])
route64 = nx.shortest_path_length(G, origin_node_0, destination_node_64, weight='length')
destination_node_65 = ox.get_nearest_node(G, destinations.loc[65,['LAT', 'LON']])
route65 = nx.shortest_path_length(G, origin_node_0, destination_node_65, weight='length')
destination_node_66 = ox.get_nearest_node(G, destinations.loc[66, ['LAT', 'LON']])
route66 = nx.shortest_path_length(G, origin_node_0, destination_node_66, weight='length')
destination_node_67 = ox.get_nearest_node(G, destinations.loc[67, ['LAT', 'LON']])
route67 = nx.shortest_path_length(G, origin_node_0, destination_node_67, weight='length')
destination_node_68 = ox.get_nearest_node(G, destinations.loc[68, ['LAT', 'LON']])
route68 = nx.shortest_path_length(G, origin_node_0, destination_node_68, weight='length')
destination_node_69 = ox.get_nearest_node(G, destinations.loc[69, ['LAT', 'LON']])
route69 = nx.shortest_path_length(G, origin_node_0, destination_node_69, weight='length')
destination_node_70 = ox.get_nearest_node(G, destinations.loc[70,['LAT', 'LON']])
route70 = nx.shortest_path_length(G, origin_node_0, destination_node_70, weight='length')
destination_node_71 = ox.get_nearest_node(G, destinations.loc[71,['LAT', 'LON']])
route71 = nx.shortest_path_length(G, origin_node_0, destination_node_71, weight='length')
destination_node_72 = ox.get_nearest_node(G, destinations.loc[72,['LAT', 'LON']])
route72 = nx.shortest_path_length(G, origin_node_0, destination_node_72, weight='length')
destination_node_73 = ox.get_nearest_node(G, destinations.loc[73,['LAT', 'LON']])
route73 = nx.shortest_path_length(G, origin_node_0, destination_node_73, weight='length')
destination_node_74 = ox.get_nearest_node(G, destinations.loc[74,['LAT', 'LON']])
route74 = nx.shortest_path_length(G, origin_node_0, destination_node_74, weight='length')
destination_node_75 = ox.get_nearest_node(G, destinations.loc[75,['LAT', 'LON']])
route75 = nx.shortest_path_length(G, origin_node_0, destination_node_75, weight='length')
destination_node_76 = ox.get_nearest_node(G, destinations.loc[76,['LAT', 'LON']])
route76 = nx.shortest_path_length(G, origin_node_0, destination_node_76, weight='length')
destination_node_77 = ox.get_nearest_node(G, destinations.loc[77,['LAT', 'LON']])
route77 = nx.shortest_path_length(G, origin_node_0, destination_node_77, weight='length')
destination_node_78 = ox.get_nearest_node(G, destinations.loc[78,['LAT', 'LON']])
route78 = nx.shortest_path_length(G, origin_node_0, destination_node_78, weight='length')
destination_node_79 = ox.get_nearest_node(G, destinations.loc[79,['LAT', 'LON']])
route79 = nx.shortest_path_length(G, origin_node_0, destination_node_79, weight='length')
destination_node_80 = ox.get_nearest_node(G, destinations.loc[80,['LAT', 'LON']])
route80 = nx.shortest_path_length(G, origin_node_0, destination_node_80, weight='length')
destination_node_81 = ox.get_nearest_node(G, destinations.loc[81, ['LAT', 'LON']])
route81 = nx.shortest_path_length(G, origin_node_0, destination_node_81, weight='length')
destination_node_82 = ox.get_nearest_node(G, destinations.loc[82, ['LAT', 'LON']])
route82 = nx.shortest_path_length(G, origin_node_0, destination_node_82, weight='length')
destination_node_83 = ox.get_nearest_node(G, destinations.loc[83, ['LAT', 'LON']])
route83 = nx.shortest_path_length(G, origin_node_0, destination_node_83, weight='length')
destination_node_84 = ox.get_nearest_node(G, destinations.loc[84,['LAT', 'LON']])
route84 = nx.shortest_path_length(G, origin_node_0, destination_node_84, weight='length')
destination_node_85 = ox.get_nearest_node(G, destinations.loc[85,['LAT', 'LON']])
route85 = nx.shortest_path_length(G, origin_node_0, destination_node_85, weight='length')
destination_node_86 = ox.get_nearest_node(G, destinations.loc[86,['LAT', 'LON']])
route86 = nx.shortest_path_length(G, origin_node_0, destination_node_86, weight='length')
destination_node_87 = ox.get_nearest_node(G, destinations.loc[87,['LAT', 'LON']])
route87 = nx.shortest_path_length(G, origin_node_0, destination_node_87, weight='length')
destination_node_88 = ox.get_nearest_node(G, destinations.loc[88,['LAT', 'LON']])
route88 = nx.shortest_path_length(G, origin_node_0, destination_node_88, weight='length')
destination_node_89 = ox.get_nearest_node(G, destinations.loc[89,['LAT', 'LON']])
route89 = nx.shortest_path_length(G, origin_node_0, destination_node_89, weight='length')
destination_node_90 = ox.get_nearest_node(G, destinations.loc[90,['LAT', 'LON']])
route90 = nx.shortest_path_length(G, origin_node_0, destination_node_90, weight='length')
destination_node_91 = ox.get_nearest_node(G, destinations.loc[91,['LAT', 'LON']])
route91 = nx.shortest_path_length(G, origin_node_0, destination_node_91, weight='length')
destination_node_92 = ox.get_nearest_node(G, destinations.loc[92,['LAT', 'LON']])
route92 = nx.shortest_path_length(G, origin_node_0, destination_node_92, weight='length')
destination_node_93 = ox.get_nearest_node(G, destinations.loc[93,['LAT', 'LON']])
route93 = nx.shortest_path_length(G, origin_node_0, destination_node_93, weight='length')
destination_node_94 = ox.get_nearest_node(G, destinations.loc[94,['LAT', 'LON']])
route94 = nx.shortest_path_length(G, origin_node_0, destination_node_94, weight='length')
destination_node_95 = ox.get_nearest_node(G, destinations.loc[95,['LAT', 'LON']])
route95 = nx.shortest_path_length(G, origin_node_0, destination_node_95, weight='length')
destination_node_96 = ox.get_nearest_node(G, destinations.loc[96, ['LAT', 'LON']])
route96 = nx.shortest_path_length(G, origin_node_0, destination_node_96, weight='length')
destination_node_97 = ox.get_nearest_node(G, destinations.loc[97, ['LAT', 'LON']])
route97 = nx.shortest_path_length(G, origin_node_0, destination_node_97, weight='length')
destination_node_98 = ox.get_nearest_node(G, destinations.loc[98, ['LAT', 'LON']])
route98 = nx.shortest_path_length(G, origin_node_0, destination_node_98, weight='length')
destination_node_99 = ox.get_nearest_node(G, destinations.loc[99, ['LAT', 'LON']])
route99 = nx.shortest_path_length(G, origin_node_0, destination_node_99, weight='length')
destination_node_100 = ox.get_nearest_node(G, destinations.loc[100, ['LAT', 'LON']])
route100 = nx.shortest_path_length(G, origin_node_0, destination_node_100, weight='length')
destination_node_101 = ox.get_nearest_node(G, destinations.loc[101, ['LAT', 'LON']])
route101 = nx.shortest_path_length(G, origin_node_0, destination_node_101, weight='length')
destination_node_102 = ox.get_nearest_node(G, destinations.loc[102, ['LAT', 'LON']])
route102 = nx.shortest_path_length(G, origin_node_0, destination_node_102, weight='length')
destination_node_103 = ox.get_nearest_node(G, destinations.loc[103, ['LAT', 'LON']])
route103 = nx.shortest_path_length(G, origin_node_0, destination_node_103, weight='length')
destination_node_104 = ox.get_nearest_node(G, destinations.loc[104,['LAT', 'LON']])
route104 = nx.shortest_path_length(G, origin_node_0, destination_node_104, weight='length')
destination_node_105 = ox.get_nearest_node(G, destinations.loc[105,['LAT', 'LON']])
route105 = nx.shortest_path_length(G, origin_node_0, destination_node_105, weight='length')
destination_node_106 = ox.get_nearest_node(G, destinations.loc[106,['LAT', 'LON']])
route106 = nx.shortest_path_length(G, origin_node_0, destination_node_106, weight='length')
destination_node_107 = ox.get_nearest_node(G, destinations.loc[107,['LAT', 'LON']])
route107 = nx.shortest_path_length(G, origin_node_0, destination_node_107, weight='length')
destination_node_108 = ox.get_nearest_node(G, destinations.loc[108,['LAT', 'LON']])
route108 = nx.shortest_path_length(G, origin_node_0, destination_node_108, weight='length')
destination_node_109 = ox.get_nearest_node(G, destinations.loc[109,['LAT', 'LON']])
route109 = nx.shortest_path_length(G, origin_node_0, destination_node_109, weight='length')
destination_node_110 = ox.get_nearest_node(G, destinations.loc[110,['LAT', 'LON']])
route110 = nx.shortest_path_length(G, origin_node_0, destination_node_110, weight='length')
destination_node_111 = ox.get_nearest_node(G, destinations.loc[111,['LAT', 'LON']])
route111 = nx.shortest_path_length(G, origin_node_0, destination_node_111, weight='length')
destination_node_112 = ox.get_nearest_node(G, destinations.loc[112,['LAT', 'LON']])
route112 = nx.shortest_path_length(G, origin_node_0, destination_node_112, weight='length')
destination_node_113 = ox.get_nearest_node(G, destinations.loc[113,['LAT', 'LON']])
route113 = nx.shortest_path_length(G, origin_node_0, destination_node_113, weight='length')
destination_node_114 = ox.get_nearest_node(G, destinations.loc[114,['LAT', 'LON']])
route114 = nx.shortest_path_length(G, origin_node_0, destination_node_114, weight='length')
destination_node_115 = ox.get_nearest_node(G, destinations.loc[115,['LAT', 'LON']])
route115 = nx.shortest_path_length(G, origin_node_0, destination_node_115, weight='length')
destination_node_116 = ox.get_nearest_node(G, destinations.loc[116, ['LAT', 'LON']])
route116 = nx.shortest_path_length(G, origin_node_0, destination_node_116, weight='length')
destination_node_117 = ox.get_nearest_node(G, destinations.loc[117, ['LAT', 'LON']])
route117 = nx.shortest_path_length(G, origin_node_0, destination_node_117, weight='length')
destination_node_118 = ox.get_nearest_node(G, destinations.loc[118, ['LAT', 'LON']])
route118 = nx.shortest_path_length(G, origin_node_0, destination_node_118, weight='length')
destination_node_119 = ox.get_nearest_node(G, destinations.loc[119, ['LAT', 'LON']])
route119 = nx.shortest_path_length(G, origin_node_0, destination_node_119, weight='length')
destination_node_120 = ox.get_nearest_node(G, destinations.loc[120,['LAT', 'LON']])
route120 = nx.shortest_path_length(G, origin_node_0, destination_node_120, weight='length')
destination_node_121 = ox.get_nearest_node(G, destinations.loc[121,['LAT', 'LON']])
route121 = nx.shortest_path_length(G, origin_node_0, destination_node_121, weight='length')
destination_node_122 = ox.get_nearest_node(G, destinations.loc[122,['LAT', 'LON']])
route122 = nx.shortest_path_length(G, origin_node_0, destination_node_122, weight='length')
destination_node_123 = ox.get_nearest_node(G, destinations.loc[123,['LAT', 'LON']])
route123 = nx.shortest_path_length(G, origin_node_0, destination_node_123, weight='length')
destination_node_124 = ox.get_nearest_node(G, destinations.loc[124,['LAT', 'LON']])
route124 = nx.shortest_path_length(G, origin_node_0, destination_node_124, weight='length')
destination_node_125 = ox.get_nearest_node(G, destinations.loc[125,['LAT', 'LON']])
route125 = nx.shortest_path_length(G, origin_node_0, destination_node_125, weight='length')
destination_node_126 = ox.get_nearest_node(G, destinations.loc[126,['LAT', 'LON']])
route126 = nx.shortest_path_length(G, origin_node_0, destination_node_126, weight='length')
destination_node_127 = ox.get_nearest_node(G, destinations.loc[127,['LAT', 'LON']])
route127 = nx.shortest_path_length(G, origin_node_0, destination_node_127, weight='length')
destination_node_128 = ox.get_nearest_node(G, destinations.loc[128,['LAT', 'LON']])
route128 = nx.shortest_path_length(G, origin_node_0, destination_node_128, weight='length')
destination_node_129 = ox.get_nearest_node(G, destinations.loc[129,['LAT', 'LON']])
route129 = nx.shortest_path_length(G, origin_node_0, destination_node_129, weight='length')
destination_node_130 = ox.get_nearest_node(G, destinations.loc[130,['LAT', 'LON']])
route130 = nx.shortest_path_length(G, origin_node_0, destination_node_130, weight='length')
destination_node_131 = ox.get_nearest_node(G, destinations.loc[131, ['LAT', 'LON']])
route131 = nx.shortest_path_length(G, origin_node_0, destination_node_131, weight='length')
destination_node_132 = ox.get_nearest_node(G, destinations.loc[132, ['LAT', 'LON']])
route132 = nx.shortest_path_length(G, origin_node_0, destination_node_132, weight='length')
destination_node_133 = ox.get_nearest_node(G, destinations.loc[133, ['LAT', 'LON']])
route133 = nx.shortest_path_length(G, origin_node_0, destination_node_133, weight='length')
destination_node_134 = ox.get_nearest_node(G, destinations.loc[134,['LAT', 'LON']])
route134 = nx.shortest_path_length(G, origin_node_0, destination_node_134, weight='length')
destination_node_135 = ox.get_nearest_node(G, destinations.loc[135,['LAT', 'LON']])
route135 = nx.shortest_path_length(G, origin_node_0, destination_node_135, weight='length')
destination_node_136 = ox.get_nearest_node(G, destinations.loc[136,['LAT', 'LON']])
route136 = nx.shortest_path_length(G, origin_node_0, destination_node_136, weight='length')
destination_node_137 = ox.get_nearest_node(G, destinations.loc[137,['LAT', 'LON']])
route137 = nx.shortest_path_length(G, origin_node_0, destination_node_137, weight='length')
destination_node_138 = ox.get_nearest_node(G, destinations.loc[138,['LAT', 'LON']])
route138 = nx.shortest_path_length(G, origin_node_0, destination_node_138, weight='length')
destination_node_139 = ox.get_nearest_node(G, destinations.loc[139,['LAT', 'LON']])
route139 = nx.shortest_path_length(G, origin_node_0, destination_node_139, weight='length')
destination_node_140 = ox.get_nearest_node(G, destinations.loc[140,['LAT', 'LON']])
route140 = nx.shortest_path_length(G, origin_node_0, destination_node_140, weight='length')
destination_node_141 = ox.get_nearest_node(G, destinations.loc[141,['LAT', 'LON']])
route141 = nx.shortest_path_length(G, origin_node_0, destination_node_141, weight='length')
destination_node_142 = ox.get_nearest_node(G, destinations.loc[142,['LAT', 'LON']])
route142 = nx.shortest_path_length(G, origin_node_0, destination_node_142, weight='length')
destination_node_143 = ox.get_nearest_node(G, destinations.loc[143,['LAT', 'LON']])
route143 = nx.shortest_path_length(G, origin_node_0, destination_node_143, weight='length')
destination_node_144 = ox.get_nearest_node(G, destinations.loc[144,['LAT', 'LON']])
route144 = nx.shortest_path_length(G, origin_node_0, destination_node_144, weight='length')
destination_node_145 = ox.get_nearest_node(G, destinations.loc[145,['LAT', 'LON']])
route145 = nx.shortest_path_length(G, origin_node_0, destination_node_145, weight='length')
destination_node_146 = ox.get_nearest_node(G, destinations.loc[146, ['LAT', 'LON']])
route146 = nx.shortest_path_length(G, origin_node_0, destination_node_146, weight='length')
destination_node_147 = ox.get_nearest_node(G, destinations.loc[147, ['LAT', 'LON']])
route147 = nx.shortest_path_length(G, origin_node_0, destination_node_147, weight='length')
destination_node_148 = ox.get_nearest_node(G, destinations.loc[148, ['LAT', 'LON']])
route148 = nx.shortest_path_length(G, origin_node_0, destination_node_148, weight='length')
destination_node_149 = ox.get_nearest_node(G, destinations.loc[149, ['LAT', 'LON']])
route149 = nx.shortest_path_length(G, origin_node_0, destination_node_149, weight='length')
destination_node_150 = ox.get_nearest_node(G, destinations.loc[150, ['LAT', 'LON']])
route150 = nx.shortest_path_length(G, origin_node_0, destination_node_150, weight='length')
destination_node_151 = ox.get_nearest_node(G, destinations.loc[151, ['LAT', 'LON']])
route151 = nx.shortest_path_length(G, origin_node_0, destination_node_151, weight='length')
destination_node_152 = ox.get_nearest_node(G, destinations.loc[152, ['LAT', 'LON']])
route152 = nx.shortest_path_length(G, origin_node_0, destination_node_152, weight='length')
destination_node_153 = ox.get_nearest_node(G, destinations.loc[153, ['LAT', 'LON']])
route153 = nx.shortest_path_length(G, origin_node_0, destination_node_153, weight='length')
destination_node_154 = ox.get_nearest_node(G, destinations.loc[154,['LAT', 'LON']])
route154 = nx.shortest_path_length(G, origin_node_0, destination_node_154, weight='length')
destination_node_155 = ox.get_nearest_node(G, destinations.loc[155,['LAT', 'LON']])
route155 = nx.shortest_path_length(G, origin_node_0, destination_node_155, weight='length')
destination_node_156 = ox.get_nearest_node(G, destinations.loc[156,['LAT', 'LON']])
route156 = nx.shortest_path_length(G, origin_node_0, destination_node_156, weight='length')
destination_node_157 = ox.get_nearest_node(G, destinations.loc[157,['LAT', 'LON']])
route157 = nx.shortest_path_length(G, origin_node_0, destination_node_157, weight='length')
destination_node_158 = ox.get_nearest_node(G, destinations.loc[158,['LAT', 'LON']])
route158 = nx.shortest_path_length(G, origin_node_0, destination_node_158, weight='length')
destination_node_159 = ox.get_nearest_node(G, destinations.loc[159,['LAT', 'LON']])
route159 = nx.shortest_path_length(G, origin_node_0, destination_node_159, weight='length')
destination_node_160 = ox.get_nearest_node(G, destinations.loc[160,['LAT', 'LON']])
route160 = nx.shortest_path_length(G, origin_node_0, destination_node_160, weight='length')
destination_node_161 = ox.get_nearest_node(G, destinations.loc[161,['LAT', 'LON']])
route161 = nx.shortest_path_length(G, origin_node_0, destination_node_161, weight='length')
destination_node_162 = ox.get_nearest_node(G, destinations.loc[162,['LAT', 'LON']])
route162 = nx.shortest_path_length(G, origin_node_0, destination_node_162, weight='length')
destination_node_163 = ox.get_nearest_node(G, destinations.loc[163,['LAT', 'LON']])
route163 = nx.shortest_path_length(G, origin_node_0, destination_node_163, weight='length')
destination_node_164 = ox.get_nearest_node(G, destinations.loc[164,['LAT', 'LON']])
route164 = nx.shortest_path_length(G, origin_node_0, destination_node_164, weight='length')
destination_node_165 = ox.get_nearest_node(G, destinations.loc[165,['LAT', 'LON']])
route165 = nx.shortest_path_length(G, origin_node_0, destination_node_165, weight='length')
destination_node_166 = ox.get_nearest_node(G, destinations.loc[166, ['LAT', 'LON']])
route166 = nx.shortest_path_length(G, origin_node_0, destination_node_166, weight='length')
destination_node_167 = ox.get_nearest_node(G, destinations.loc[167, ['LAT', 'LON']])
route167 = nx.shortest_path_length(G, origin_node_0, destination_node_167, weight='length')
destination_node_168 = ox.get_nearest_node(G, destinations.loc[168, ['LAT', 'LON']])
route168 = nx.shortest_path_length(G, origin_node_0, destination_node_168, weight='length')
destination_node_169 = ox.get_nearest_node(G, destinations.loc[169, ['LAT', 'LON']])
route169 = nx.shortest_path_length(G, origin_node_0, destination_node_169, weight='length')
destination_node_170 = ox.get_nearest_node(G, destinations.loc[170,['LAT', 'LON']])
route170 = nx.shortest_path_length(G, origin_node_0, destination_node_170, weight='length')
destination_node_171 = ox.get_nearest_node(G, destinations.loc[171,['LAT', 'LON']])
route171 = nx.shortest_path_length(G, origin_node_0, destination_node_171, weight='length')
destination_node_172 = ox.get_nearest_node(G, destinations.loc[172,['LAT', 'LON']])
route172 = nx.shortest_path_length(G, origin_node_0, destination_node_172, weight='length')
destination_node_173 = ox.get_nearest_node(G, destinations.loc[173,['LAT', 'LON']])
route173 = nx.shortest_path_length(G, origin_node_0, destination_node_173, weight='length')
destination_node_174 = ox.get_nearest_node(G, destinations.loc[174,['LAT', 'LON']])
route174 = nx.shortest_path_length(G, origin_node_0, destination_node_174, weight='length')
destination_node_175 = ox.get_nearest_node(G, destinations.loc[175,['LAT', 'LON']])
route175 = nx.shortest_path_length(G, origin_node_0, destination_node_175, weight='length')
destination_node_176 = ox.get_nearest_node(G, destinations.loc[176,['LAT', 'LON']])
route176 = nx.shortest_path_length(G, origin_node_0, destination_node_176, weight='length')
destination_node_177 = ox.get_nearest_node(G, destinations.loc[177,['LAT', 'LON']])
route177 = nx.shortest_path_length(G, origin_node_0, destination_node_177, weight='length')
destination_node_178 = ox.get_nearest_node(G, destinations.loc[178,['LAT', 'LON']])
route178 = nx.shortest_path_length(G, origin_node_0, destination_node_178, weight='length')
destination_node_179 = ox.get_nearest_node(G, destinations.loc[179,['LAT', 'LON']])
route179 = nx.shortest_path_length(G, origin_node_0, destination_node_179, weight='length')
destination_node_180 = ox.get_nearest_node(G, destinations.loc[180,['LAT', 'LON']])
route180 = nx.shortest_path_length(G, origin_node_0, destination_node_180, weight='length')
destination_node_181 = ox.get_nearest_node(G, destinations.loc[181, ['LAT', 'LON']])
route181 = nx.shortest_path_length(G, origin_node_0, destination_node_181, weight='length')
destination_node_182 = ox.get_nearest_node(G, destinations.loc[182, ['LAT', 'LON']])
route182 = nx.shortest_path_length(G, origin_node_0, destination_node_182, weight='length')
destination_node_183 = ox.get_nearest_node(G, destinations.loc[183, ['LAT', 'LON']])
route183 = nx.shortest_path_length(G, origin_node_0, destination_node_183, weight='length')
destination_node_184 = ox.get_nearest_node(G, destinations.loc[184,['LAT', 'LON']])
route184 = nx.shortest_path_length(G, origin_node_0, destination_node_184, weight='length')
destination_node_185 = ox.get_nearest_node(G, destinations.loc[185,['LAT', 'LON']])
route185 = nx.shortest_path_length(G, origin_node_0, destination_node_185, weight='length')
destination_node_186 = ox.get_nearest_node(G, destinations.loc[186,['LAT', 'LON']])
route186 = nx.shortest_path_length(G, origin_node_0, destination_node_186, weight='length')
destination_node_187 = ox.get_nearest_node(G, destinations.loc[187,['LAT', 'LON']])
route187 = nx.shortest_path_length(G, origin_node_0, destination_node_187, weight='length')
destination_node_188 = ox.get_nearest_node(G, destinations.loc[188,['LAT', 'LON']])
route188 = nx.shortest_path_length(G, origin_node_0, destination_node_188, weight='length')
destination_node_189 = ox.get_nearest_node(G, destinations.loc[189,['LAT', 'LON']])
route189 = nx.shortest_path_length(G, origin_node_0, destination_node_189, weight='length')
destination_node_190 = ox.get_nearest_node(G, destinations.loc[190,['LAT', 'LON']])
route190 = nx.shortest_path_length(G, origin_node_0, destination_node_190, weight='length')
destination_node_191 = ox.get_nearest_node(G, destinations.loc[191,['LAT', 'LON']])
route191 = nx.shortest_path_length(G, origin_node_0, destination_node_191, weight='length')
destination_node_192 = ox.get_nearest_node(G, destinations.loc[192,['LAT', 'LON']])
route192 = nx.shortest_path_length(G, origin_node_0, destination_node_192, weight='length')
destination_node_193 = ox.get_nearest_node(G, destinations.loc[193,['LAT', 'LON']])
route193 = nx.shortest_path_length(G, origin_node_0, destination_node_193, weight='length')
destination_node_194 = ox.get_nearest_node(G, destinations.loc[194,['LAT', 'LON']])
route194 = nx.shortest_path_length(G, origin_node_0, destination_node_194, weight='length')
destination_node_195 = ox.get_nearest_node(G, destinations.loc[195,['LAT', 'LON']])
route195 = nx.shortest_path_length(G, origin_node_0, destination_node_195, weight='length')
destination_node_196 = ox.get_nearest_node(G, destinations.loc[196, ['LAT', 'LON']])
route196 = nx.shortest_path_length(G, origin_node_0, destination_node_196, weight='length')
destination_node_197 = ox.get_nearest_node(G, destinations.loc[197, ['LAT', 'LON']])
route197 = nx.shortest_path_length(G, origin_node_0, destination_node_197, weight='length')
destination_node_198 = ox.get_nearest_node(G, destinations.loc[198, ['LAT', 'LON']])
route198 = nx.shortest_path_length(G, origin_node_0, destination_node_198, weight='length')
destination_node_199 = ox.get_nearest_node(G, destinations.loc[199, ['LAT', 'LON']])
route199 = nx.shortest_path_length(G, origin_node_0, destination_node_199, weight='length')
destination_node_200 = ox.get_nearest_node(G, destinations.loc[200, ['LAT', 'LON']])
route200 = nx.shortest_path_length(G, origin_node_0, destination_node_200, weight='length')
destination_node_201 = ox.get_nearest_node(G, destinations.loc[201, ['LAT', 'LON']])
route201 = nx.shortest_path_length(G, origin_node_0, destination_node_201, weight='length')
destination_node_202 = ox.get_nearest_node(G, destinations.loc[202, ['LAT', 'LON']])
route202 = nx.shortest_path_length(G, origin_node_0, destination_node_202, weight='length')
destination_node_203 = ox.get_nearest_node(G, destinations.loc[203, ['LAT', 'LON']])
route203 = nx.shortest_path_length(G, origin_node_0, destination_node_203, weight='length')
destination_node_204 = ox.get_nearest_node(G, destinations.loc[204,['LAT', 'LON']])
route204 = nx.shortest_path_length(G, origin_node_0, destination_node_204, weight='length')
destination_node_205 = ox.get_nearest_node(G, destinations.loc[205,['LAT', 'LON']])
route205 = nx.shortest_path_length(G, origin_node_0, destination_node_205, weight='length')
destination_node_206 = ox.get_nearest_node(G, destinations.loc[206,['LAT', 'LON']])
route206 = nx.shortest_path_length(G, origin_node_0, destination_node_206, weight='length')
destination_node_207 = ox.get_nearest_node(G, destinations.loc[207,['LAT', 'LON']])
route207 = nx.shortest_path_length(G, origin_node_0, destination_node_207, weight='length')
destination_node_208 = ox.get_nearest_node(G, destinations.loc[208,['LAT', 'LON']])
route208 = nx.shortest_path_length(G, origin_node_0, destination_node_208, weight='length')
destination_node_209 = ox.get_nearest_node(G, destinations.loc[209,['LAT', 'LON']])
route209 = nx.shortest_path_length(G, origin_node_0, destination_node_209, weight='length')
destination_node_210 = ox.get_nearest_node(G, destinations.loc[210,['LAT', 'LON']])
route210 = nx.shortest_path_length(G, origin_node_0, destination_node_210, weight='length')
destination_node_211 = ox.get_nearest_node(G, destinations.loc[211,['LAT', 'LON']])
route211 = nx.shortest_path_length(G, origin_node_0, destination_node_211, weight='length')
destination_node_212 = ox.get_nearest_node(G, destinations.loc[212,['LAT', 'LON']])
route212 = nx.shortest_path_length(G, origin_node_0, destination_node_212, weight='length')
destination_node_213 = ox.get_nearest_node(G, destinations.loc[213,['LAT', 'LON']])
route213 = nx.shortest_path_length(G, origin_node_0, destination_node_213, weight='length')
destination_node_214 = ox.get_nearest_node(G, destinations.loc[214,['LAT', 'LON']])
route214 = nx.shortest_path_length(G, origin_node_0, destination_node_214, weight='length')
destination_node_215 = ox.get_nearest_node(G, destinations.loc[215,['LAT', 'LON']])
route215 = nx.shortest_path_length(G, origin_node_0, destination_node_215, weight='length')
destination_node_216 = ox.get_nearest_node(G, destinations.loc[216, ['LAT', 'LON']])
route216 = nx.shortest_path_length(G, origin_node_0, destination_node_216, weight='length')
destination_node_217 = ox.get_nearest_node(G, destinations.loc[217, ['LAT', 'LON']])
route217 = nx.shortest_path_length(G, origin_node_0, destination_node_217, weight='length')
destination_node_218 = ox.get_nearest_node(G, destinations.loc[218, ['LAT', 'LON']])
route218 = nx.shortest_path_length(G, origin_node_0, destination_node_218, weight='length')
destination_node_219 = ox.get_nearest_node(G, destinations.loc[219, ['LAT', 'LON']])
route219 = nx.shortest_path_length(G, origin_node_0, destination_node_219, weight='length')
destination_node_220 = ox.get_nearest_node(G, destinations.loc[220,['LAT', 'LON']])
route220 = nx.shortest_path_length(G, origin_node_0, destination_node_220, weight='length')
destination_node_221 = ox.get_nearest_node(G, destinations.loc[221,['LAT', 'LON']])
route221 = nx.shortest_path_length(G, origin_node_0, destination_node_221, weight='length')
destination_node_222 = ox.get_nearest_node(G, destinations.loc[222,['LAT', 'LON']])
route222 = nx.shortest_path_length(G, origin_node_0, destination_node_222, weight='length')
destination_node_223 = ox.get_nearest_node(G, destinations.loc[223,['LAT', 'LON']])
route223 = nx.shortest_path_length(G, origin_node_0, destination_node_223, weight='length')
destination_node_224 = ox.get_nearest_node(G, destinations.loc[224,['LAT', 'LON']])
route224 = nx.shortest_path_length(G, origin_node_0, destination_node_224, weight='length')
destination_node_225 = ox.get_nearest_node(G, destinations.loc[225,['LAT', 'LON']])
route225 = nx.shortest_path_length(G, origin_node_0, destination_node_225, weight='length')
destination_node_226 = ox.get_nearest_node(G, destinations.loc[226,['LAT', 'LON']])
route226 = nx.shortest_path_length(G, origin_node_0, destination_node_226, weight='length')
destination_node_227 = ox.get_nearest_node(G, destinations.loc[227,['LAT', 'LON']])
route227 = nx.shortest_path_length(G, origin_node_0, destination_node_227, weight='length')
destination_node_228 = ox.get_nearest_node(G, destinations.loc[228,['LAT', 'LON']])
route228 = nx.shortest_path_length(G, origin_node_0, destination_node_228, weight='length')
destination_node_229 = ox.get_nearest_node(G, destinations.loc[229,['LAT', 'LON']])
route229 = nx.shortest_path_length(G, origin_node_0, destination_node_229, weight='length')
destination_node_230 = ox.get_nearest_node(G, destinations.loc[230,['LAT', 'LON']])
route230 = nx.shortest_path_length(G, origin_node_0, destination_node_230, weight='length')
destination_node_231 = ox.get_nearest_node(G, destinations.loc[231, ['LAT', 'LON']])
route231 = nx.shortest_path_length(G, origin_node_0, destination_node_231, weight='length')
destination_node_232 = ox.get_nearest_node(G, destinations.loc[232, ['LAT', 'LON']])
route232 = nx.shortest_path_length(G, origin_node_0, destination_node_232, weight='length')
destination_node_233 = ox.get_nearest_node(G, destinations.loc[233, ['LAT', 'LON']])
route233 = nx.shortest_path_length(G, origin_node_0, destination_node_233, weight='length')
destination_node_234 = ox.get_nearest_node(G, destinations.loc[234,['LAT', 'LON']])
route234 = nx.shortest_path_length(G, origin_node_0, destination_node_234, weight='length')
destination_node_235 = ox.get_nearest_node(G, destinations.loc[235,['LAT', 'LON']])
route235 = nx.shortest_path_length(G, origin_node_0, destination_node_235, weight='length')
destination_node_236 = ox.get_nearest_node(G, destinations.loc[236,['LAT', 'LON']])
route236 = nx.shortest_path_length(G, origin_node_0, destination_node_236, weight='length')
destination_node_237 = ox.get_nearest_node(G, destinations.loc[237,['LAT', 'LON']])
route237 = nx.shortest_path_length(G, origin_node_0, destination_node_237, weight='length')
destination_node_238 = ox.get_nearest_node(G, destinations.loc[238,['LAT', 'LON']])
route238 = nx.shortest_path_length(G, origin_node_0, destination_node_238, weight='length')
destination_node_239 = ox.get_nearest_node(G, destinations.loc[239,['LAT', 'LON']])
route239 = nx.shortest_path_length(G, origin_node_0, destination_node_239, weight='length')
destination_node_240 = ox.get_nearest_node(G, destinations.loc[240,['LAT', 'LON']])
route240 = nx.shortest_path_length(G, origin_node_0, destination_node_240, weight='length')
destination_node_241 = ox.get_nearest_node(G, destinations.loc[241,['LAT', 'LON']])
route241 = nx.shortest_path_length(G, origin_node_0, destination_node_241, weight='length')
destination_node_242 = ox.get_nearest_node(G, destinations.loc[242,['LAT', 'LON']])
route242 = nx.shortest_path_length(G, origin_node_0, destination_node_242, weight='length')
destination_node_243 = ox.get_nearest_node(G, destinations.loc[243,['LAT', 'LON']])
route243 = nx.shortest_path_length(G, origin_node_0, destination_node_243, weight='length')
destination_node_244 = ox.get_nearest_node(G, destinations.loc[244,['LAT', 'LON']])
route244 = nx.shortest_path_length(G, origin_node_0, destination_node_244, weight='length')
destination_node_245 = ox.get_nearest_node(G, destinations.loc[245,['LAT', 'LON']])
route245 = nx.shortest_path_length(G, origin_node_0, destination_node_245, weight='length')
destination_node_246 = ox.get_nearest_node(G, destinations.loc[246, ['LAT', 'LON']])
route246 = nx.shortest_path_length(G, origin_node_0, destination_node_246, weight='length')
destination_node_247 = ox.get_nearest_node(G, destinations.loc[247, ['LAT', 'LON']])
route247 = nx.shortest_path_length(G, origin_node_0, destination_node_247, weight='length')
destination_node_248 = ox.get_nearest_node(G, destinations.loc[248, ['LAT', 'LON']])
route248 = nx.shortest_path_length(G, origin_node_0, destination_node_248, weight='length')
destination_node_249 = ox.get_nearest_node(G, destinations.loc[249, ['LAT', 'LON']])
route249 = nx.shortest_path_length(G, origin_node_0, destination_node_249, weight='length')

route, route1, route2, route3, route4, route5, route6, route7, route8, route9, route10, route11, route12, route13, route14,
route15, route16, route17, route18, route19, route20, route21, route22, route23, route24, route25, route26, route27, route28,
route29, route30, route31, route32, route33, route34, route35, route36, route37, route38, route39, route40, route41, route42,
route43, route44, route45, route46, route47, route48, route49, route50, route51, route52, route53, route54, route55, route56,
route57, route58, route59, route60, route61, route62, route63, route64, route65, route66, route67, route68, route69, route70,
route71, route72, route73, route74, route75, route76, route77, route78, route79, route80, route81, route82, route83, route84,
route85, route86, route87, route88, route89, route90, route91, route92, route93, route94, route95, route96, route97, route98,
route99, route100, route101, route102, route103, route104, route105, route106, route107, route108, route109, route110, route111,
route112, route113, route114, route115, route116, route117, route118, route119, route120, route121, route122, route123, route124,
route125, route126, route127, route128, route129, route130, route131, route132, route133, route134, route135, route136, route137,
route137, route138, route139, route140, route141, route142, route143, route144, route145, route146, route147, route148, route149,
route150, route151, route152, route153, route154, route155, route156, route157, route158, route159, route160, route161, route162,
route163, route164, route165, route166, route167, route168, route169, route170, route171, route172, route173, route174, route175,
route176, route177, route178, route179, route180, route181, route182, route183, route184, route185, route186, route187, route188,
route189, route190, route191, route192, route193, route194, route195, route196, route197, route198, route199, route200, route201,
route202, route203, route204, route205, route206, route207, route208, route209, route210, route211, route212, route213, route214,
route215, route216, route217, route218, route219, route220, route221, route222, route223, route224, route225, route226, route227,
route228, route229, route230, route231, route232, route233, route234, route235, route236, route237, route238, route239, route240,
route241, route242, route243, route244, route245, route246, route247, route248, route249

# print mean average
print(statistics.mean([route, route1, route2, route3, route4, route5, route6, route7, route8, route9, route10, route11, route12, route13, route14,
route15, route16, route17, route18, route19, route20, route21, route22, route23, route24, route25, route26, route27, route28,
route29, route30, route31, route32, route33, route34, route35, route36, route37, route38, route39, route40, route41, route42,
route43, route44, route45, route46, route47, route48, route49, route50, route51, route52, route53, route54, route55, route56,
route57, route58, route59, route60, route61, route62, route63, route64, route65, route66, route67, route68, route69, route70,
route71, route72, route73, route74, route75, route76, route77, route78, route79, route80, route81, route82, route83, route84,
route85, route86, route87, route88, route89, route90, route91, route92, route93, route94, route95, route96, route97, route98,
route99, route100, route101, route102, route103, route104, route105, route106, route107, route108, route109, route110, route111,
route112, route113, route114, route115, route116, route117, route118, route119, route120, route121, route122, route123, route124,
route125, route126, route127, route128, route129, route130, route131, route132, route133, route134, route135, route136, route137,
route137, route138, route139, route140, route141, route142, route143, route144, route145, route146, route147, route148, route149,
route150, route151, route152, route153, route154, route155, route156, route157, route158, route159, route160, route161, route162,
route163, route164, route165, route166, route167, route168, route169, route170, route171, route172, route173, route174, route175,
route176, route177, route178, route179, route180, route181, route182, route183, route184, route185, route186, route187, route188,
route189, route190, route191, route192, route193, route194, route195, route196, route197, route198, route199, route200, route201,
route202, route203, route204, route205, route206, route207, route208, route209, route210, route211, route212, route213, route214,
route215, route216, route217, route218, route219, route220, route221, route222, route223, route224, route225, route226, route227,
route228, route229, route230, route231, route232, route233, route234, route235, route236, route237, route238, route239, route240,
route241, route242, route243, route244, route245, route246, route247, route248, route249]))








share|improve this question












share|improve this question




share|improve this question








edited Aug 3 at 16:57
























asked Aug 1 at 19:27









Moon

112




112











  • Welcome to Code Review! it appears you have a registered account (as evidenced by the suggested edit), which can be merged with your unregistered account. You can use the contact SE page and request the accounts be merged.
    – Sam Onela
    Aug 2 at 16:32










  • This code calculates for 2 points. Are you saying your actual codes calculates for 250 nodes? If so, please include that code instead of this example. We don't mind large pieces of code if they're accompanied by a solid explanation.
    – Mast
    Aug 3 at 7:21
















  • Welcome to Code Review! it appears you have a registered account (as evidenced by the suggested edit), which can be merged with your unregistered account. You can use the contact SE page and request the accounts be merged.
    – Sam Onela
    Aug 2 at 16:32










  • This code calculates for 2 points. Are you saying your actual codes calculates for 250 nodes? If so, please include that code instead of this example. We don't mind large pieces of code if they're accompanied by a solid explanation.
    – Mast
    Aug 3 at 7:21















Welcome to Code Review! it appears you have a registered account (as evidenced by the suggested edit), which can be merged with your unregistered account. You can use the contact SE page and request the accounts be merged.
– Sam Onela
Aug 2 at 16:32




Welcome to Code Review! it appears you have a registered account (as evidenced by the suggested edit), which can be merged with your unregistered account. You can use the contact SE page and request the accounts be merged.
– Sam Onela
Aug 2 at 16:32












This code calculates for 2 points. Are you saying your actual codes calculates for 250 nodes? If so, please include that code instead of this example. We don't mind large pieces of code if they're accompanied by a solid explanation.
– Mast
Aug 3 at 7:21




This code calculates for 2 points. Are you saying your actual codes calculates for 250 nodes? If so, please include that code instead of this example. We don't mind large pieces of code if they're accompanied by a solid explanation.
– Mast
Aug 3 at 7:21















active

oldest

votes











Your Answer




StackExchange.ifUsing("editor", function ()
return StackExchange.using("mathjaxEditing", function ()
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
);
);
, "mathjax-editing");

StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "196"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f200773%2fmean-average-shortest-path-lengths-networkx-and-osmnx%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f200773%2fmean-average-shortest-path-lengths-networkx-and-osmnx%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Greedy Best First Search implementation in Rust

Function to Return a JSON Like Objects Using VBA Collections and Arrays

C++11 CLH Lock Implementation