I am using scipy.spatial ConvexHull to create an envelope around a dataset, here is an example that creates the dataset and the envelope using ConvexHull,
import pandas as pd
import numpy as np
from scipy.spatial import ConvexHull, convex_hull_plot_2d
df = pd.DataFrame(np.random.randn(1000, 2), columns=list(['col1', 'col2']))
hull = ConvexHull(df[['col1', 'col2']])
hull_indices = hull.vertices
print(df.iloc[hull_indices])
I would now like to remove a ConvexHull Vertices if it is a close neighbour. The intent is to reduce the number of ConvexHull Vertices.
Could I use scipy.spatial.KDTree to find the close neighbour?
Thanks in advance for any help.