def get_node_ids(self, x_col, y_col, mapping_distance=None):
xys = pd.DataFrame({'<STR_LIT:x>': x_col, '<STR_LIT:y>': y_col})<EOL>distances, indexes = self.kdtree.query(xys.as_matrix())<EOL>indexes = np.transpose(indexes)[<NUM_LIT:0>]<EOL>distances = np.transpose(distances)[<NUM_LIT:0>]<EOL>node_ids = self.nodes_df.iloc[indexes].index<EOL>df = pd.DataFrame({"<STR_LIT>": node_ids, "<STR_LIT>": distances},<EOL>index=xys.index)<EOL>if mapping_distance is not None:<EOL><INDENT>df = df[df.distance <= mapping_distance]<EOL><DEDENT>return df.node_id<EOL>
Assign node_ids to data specified by x_col and y_col

Parameters
----------
x_col : Pandas series (float)
    A Pandas Series where values specify the x (e.g. longitude)
    location of dataset.
y_col : Pandas series (float)
    A Pandas Series where values specify the y (e.g. latitude)
    location of dataset.  x_col and y_col should use the same index.
mapping_distance : float, optional
    The maximum distance that will be considered a match between the
    x, y data and the nearest node in the network.  This will usually
    be a distance unit in meters however if you have customized the
    impedance this could be in other units such as utility or time
    etc. If not specified, every x, y coordinate will be mapped to
    the nearest node.

Returns
-------
node_ids : Pandas series (int)
    Returns a Pandas Series of node_ids for each x, y in the
    input data. The index is the same as the indexes of the
    x, y input data, and the values are the mapped node_ids.
    If mapping distance is not passed and if there are no nans in the
    x, y data, this will be the same length as the x, y data.
    If the mapping is imperfect, this function returns all the
    input x, y's that were successfully mapped to node_ids.