Creating a Distance Matrix?

I think you are intrested in distance_matrix. For example: Create data: import pandas as pd from scipy.spatial import distance_matrix data = [[5, 7], [7, 3], [8, 1]] ctys = [‘Boston’, ‘Phoenix’, ‘New York’] df = pd.DataFrame(data, columns=[‘xcord’, ‘ycord’], index=ctys) Output: xcord ycord Boston 5 7 Phoenix 7 3 New York 8 1 Using the distance … Read more

How to efficiently assign unique ID to individuals with multiple entries based on name in very large df

This approach uses .groupby() and .ngroup() (new in Pandas 0.20.2) to create the id column: df[‘id’] = df.groupby([‘LastName’,’FirstName’]).ngroup() >>> df First Second id 0 Tom Jones 0 1 Tom Jones 0 2 David Smith 1 3 Alex Thompson 2 4 Alex Thompson 2 I checked timings and, for the small dataset in this example, Alexander’s … Read more

404 Not Found

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.