Find the distance to each feature’s nearest neighbor.
Parameters: | features : DataFrame pos_columns : list of column names
|
---|---|
Returns: | proximity : DataFrame
|
Examples
Find the proximity of each particle to its nearest neighbor in every frame.
>>> prox = t.groupby('frame').apply(proximity).reset_index()
>>> avg_prox = prox.groupby('particle')['proximity'].mean()
And filter the trajectories...
>>> particle_nos = avg_prox[avg_prox > 20].index
>>> t_filtered = t[t['particle'].isin(particle_nos)]