Beispiel #1
0
def make_edges(latlondf, **kwargs):
	edgelambda = lambda x: find_closest(x, latlondf, *kwargs)
	n = latlondf.apply(edgelambda, axis = 1)

	edges = pd.DataFrame(columns=['node1', 'node2'])

	for node1 in n.index:
	    for node2 in n.ix[node1]:
	        newrow = {'node1':node1, 'node2':node2}
	        edges = edges.append(newrow, ignore_index=True)
	edges.index.name = 'edge'
	return edges.astype('int')
Beispiel #2
0
def make_edges(latlondf, **kwargs):
    edgelambda = lambda x: find_closest(x, latlondf, *kwargs)
    n = latlondf.apply(edgelambda, axis=1)

    edges = pd.DataFrame(columns=['node1', 'node2'])

    for node1 in n.index:
        for node2 in n.ix[node1]:
            newrow = {'node1': node1, 'node2': node2}
            edges = edges.append(newrow, ignore_index=True)
    edges.index.name = 'edge'
    return edges.astype('int')
Beispiel #3
0
 def edgelambda(x):
     """featurize.find_closest for use in apply to dataframe"""
     return find_closest(x, latlondf)