I'm using a function to determine if resources can be used again or not.
This is the numpy array i'mI'm using.
First step is to find all resource available on a date, for example (2019-05-16 from 8:30 to 17:30). To achieve this iI used np.wherenp.where like the example below:
av_resource_np = resource_availability_np[np.where(
(resource_availability_np[:,1] <= '2019-05-16')
& (resource_availability_np[:,2] >= '2019-05-16')
& (resource_availability_np[:,3] <= '17:30:00')
& (resource_availability_np[:,4] >= '08:30:00'))]
Here iI try to find unique resource ids and the sum of their overload factor using np.unique()np.unique():
unique_id, count_nb = np.unique(av_resource_np[:,(0,5)], axis=0, return_counts=True)
availability_mat = np.column_stack((unique_id, count_nb ))
Which yields the followigfollowing results:
So this is main idea behind my function, the problem here is that it takes more than 60% of the whole program runtime and iI would appreciate any advice about how to make it more efficient/faster. Thank you.