Relative Content

Tag Archive for pythonpandasgeopandas

Is there any way to optimize my function for district matching using Python’s GeoPandas and Pandas?

I have a table with polygons and district names; I also have data on purchases with exact longitude and latitude. I wrote a function that checks for every coordinate pair a match in a polygon; then it assigns district name for a purchase. The problem is that it works very-very slow due to lack of vectorization and nested for-loops (thanks, pandas). How can I optimize so it will digest 10+ million rows in less time?