-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.stats
Milestone
Description
For certain inputs binned_statistic_2d returns incorrect bin numbers
xEdges = np.arange(79950.,500050.,100.)
yEdges = np.arange(7489950.,7860050.,100.)
x = 356643.378
y = 7813944.500
binned, xedges, yedges, binnums = binned_statistic_2d((x,), (y,), (0.5,), 'mean', bins=[xEdges,yEdges],expand_binnumbers=True)
The binnums seem to be incorrect:
> binnums Returns: array([[3678], [1291]])
> np.where(np.isfinite(binned)) Returns: (array([2766]), array([3239]))
I worked around this using the following code to calculate the bin numbers:
x_inds = np.searchsorted(xEdges, x)
y_inds = np.searchsorted(yEdges , y)
Metadata
Metadata
Assignees
Labels
defectA clear bug or issue that prevents SciPy from being installed or used as expectedA clear bug or issue that prevents SciPy from being installed or used as expectedscipy.stats