I have a numpy array containing millions of hourly x y points with the "columns" of the array being x, y, hour, and day of week (all ints). Here is an example of what the array looks like:
array([[1, 2, 0, 0],
[3, 5, 0, 0],
[6, 3, 1, 0],
[6, 2, 3, 0],
[4, 3, 3, 1]])
I have created a grid of zeros that I can increment for all values in the array:
grid = np.zeros((8,8))
for value in range(0,len(xy_new[:,1])):
grid[xy_new[value][1],xy_new[value][0]] += 1
but I need to be able to do this for each hour by day of week (ie Sun at hour 0, Sun at hour 1, etc.).
How do I subset the array by hour and day of week?
I have attempted modifying the answers here: Make subset of array, based on values of two other arrays in Python, Subsetting data in Python, but have not been successful. Any help would be greatly appreciated!!