我有一个数据帧有大量的经纬度点(305000)。我想通过每次迭代取样并计算每个连续行之间的正弦值距离来减小数据帧的大小。如果距离太小,我想删除这两点之一。我如何在Python中做到这一点?我想使用shift(),但我不知道使用它的方式。这是我想要做的。减少经纬度
rows=random.sample(df.index,50)
for i in range(50):
rows = np.random.choice(df.index.values, 1000)
sampled_df = df.ix[rows]
if haversine(sampled_df,sampled_df.shift()) < e
delete one row