Grouping sorted coordinates based on proximity to each other
General comments:

You are basically using the groups dict like a list.  Might as well just use a list.

An empty data structure (list, dict, set, tuple) is False in a boolean context, so while len(points) &gt; 1: can be simplified to while points:

It is generally slower to pop from the front of a list than the back of a list, because after removing the first item all the rest of the items get moved up one spot.

points.pop() actually changes the list passed in.  Make sure that's what you want.

filter(None, points) filters out all "False" items.

[ ... ] creates a list.  So, list( [ ... ] ) is redundant.

You can just use x1, y1 = ref.

Put that all together and you get something like:

def group_points(points):
    groups = []
    while points:
        far_points = []
        ref = points.pop()
        groups.append([ref])
        for point in points:
            d = get_distance(ref, point)
            if d &lt; 30:
                groups[-1].append(point)
            else:
                far_points.append(point)

        points = far_points

    # perform average operation on each group
    return [list(np.mean(x, axis=1).astype(int)) for x in groups]

def get_distance(ref, point):
    # print('ref: {} , point: {}'.format(ref, point))
    x1, y1 = ref
    x2, y2 = point
    return math.hypot(x2 - x1, y2 - y1)


You also might want to look at functions in scipy.cluster.