-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: IntervalIndex.get_indexer raising for read only array #53703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Should we just generally go back to using ndarray instead of memoryviews? If we set that expectation could be a good change for new contributors to pick up |
This change is only necessary because cython does not support const with fused types unfortunately |
Ah OK. So I guess the pattern is for fused types prefer ndarray (unless that gets fixed/implemented) elsewhere memview? |
Yep that makes sense I guess |
|
||
result = idx.get_indexer_non_unique(arr)[0] | ||
expected = np.array([0, 1]) | ||
tm.assert_numpy_array_equal(result, expected, check_dtype=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm what's going on with the dtype? Wouldn't expect that issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows/non windows stuff and since the dtype really doesnt matter here, I just ignored it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can explicitly specify the type of the np.array call instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would kill the 32 bit build... Open for suggestions but dtype really doesn't matter
And that's also what we already do in most places. For example in groupby.pyx, you will see that we typically use ndarray for the input values (which use a fused type and can be const), while mostly use memoryviews for output values (which are writeable) or labels/mask (which don't use fused types). |
merging this, happy to address comments in a follow up. |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.