In the below table 1 row refers to 1 property. The latitude and longitude refers to the properties GPS coordinates and the price is the price for the property. The distances are the distance between one row and another in kilometers. This means, 0.1 is 100 meters, and 0.05 is 50 meters.
The goal is to group the properties which are within a 100 meter radius and get the average price.
latitude longitude price distance0 distance1 distance2 distance3 distance4 distance5 distance6 distance7 distance8 distance9
0 55.6632 12.6288 2595000 0.000000 0.046580 0.046580 0.031053 0.031053 0.093159 0.046580 0.046580 0.046580 0.093159
1 55.6637 12.6291 2850000 0.046580 0.000000 0.000000 0.015527 0.015527 0.046580 0.000000 0.093159 0.093159 0.046580
2 55.6637 12.6291 2850000 0.046580 0.000000 0.000000 0.015527 0.015527 0.046580 0.000000 0.093159 0.093159 0.046580
3 55.6632 12.6290 3198000 0.031053 0.015527 0.015527 0.000000 0.000000 0.062106 0.015527 0.077633 0.077633 0.062106
4 55.6632 12.6290 2995000 0.031053 0.015527 0.015527 0.000000 0.000000 0.062106 0.015527 0.077633 0.077633 0.062106
5 55.6638 12.6294 2395000 0.093159 0.046580 0.046580 0.062106 0.062106 0.000000 0.046580 0.139739 0.139739 0.000000
6 55.6637 12.6291 2995000 0.046580 0.000000 0.000000 0.015527 0.015527 0.046580 0.000000 0.093159 0.093159 0.046580
7 55.6642 12.6285 4495000 0.046580 0.093159 0.093159 0.077633 0.077633 0.139739 0.093159 0.000000 0.000000 0.139739
8 55.6632 12.6285 3998000 0.046580 0.093159 0.093159 0.077633 0.077633 0.139739 0.093159 0.000000 0.000000 0.139739
9 55.6638 12.6294 3975000 0.093159 0.046580 0.046580 0.062106 0.062106 0.000000 0.046580 0.139739 0.139739 0.000000
The resulting dataframe would have a new column at the end with the average price for properties within a 100 meter radius.
EDIT: The thinking is, if we take the column "distance0" as an example. Going through every data point that is under 0.1, it should take the price of those data points and and return the average in index 0 in a new column called "avg_price_per_100m_radius"
