I have a cluster of 10 Latitudes and Longitudes. I want to find the optimal location to do set up a lemonade stand.
So in other words, I need to find the best representative point of the group of latitudes and longitudes.
I’m aware of how to find the centroid (center), but I don’t necessarily want the centroid.
I just want to find what point (latitude, longitude) is best representative of the cluster.
Im a beginning python learner, so I’m having a little trouble finding some approaches. I’d really appreciate it if someone can link sources or name some methods as to how I can do this.
Centroid is basically average of your latitudes and longitudes so the easiest way to find one is by
latsum = sum(latitudes)
lonsum = sum(longitudes)
centroid = (latsum/len(latitudes) , lonsum/len(longitudes))
The sum function does what it says and the len function gives you the length of list which in your case is 10. Since you mentioned that the best representative is what you need, you might need to clear out any outliers in your data.
https://machinelearningmastery.com/how-to-use-statistics-to-identify-outliers-in-data/
This is a good resource for you to start understanding making data science operations in python.
How to prevent a token created with OAuth 2.0 from expiring?
Above is simple code changes list size during iterating itself
I'm trying to email using Python's smtplibThis is the email() function:
Anyone know how to rearrange this code so that when the values that are inputted are 3 4 8 4 , the average is 475
I'm wondering why I get 0 for the print(a) call in the last lineI put 0 for the first loop of the add()function and it should return 1 and so on in the for loop