-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: trim unreachable indexing code #31768
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.
This is all just internal right?
@@ -1070,7 +1065,7 @@ def _set_with(self, key, value): | |||
|
|||
def _set_labels(self, key, value): | |||
key = com.asarray_tuplesafe(key) | |||
indexer = self.index.get_indexer(key) | |||
indexer: np.ndarray = self.index.get_indexer(key) |
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.
Shouldn't need to annotate like this; if anything should set the return of get_indexer
to np.ndarray
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.
yah, im trying to pin down what gets passed to _set_values below. The check on L1075 is never True, so id like to see if we can rip it out
Yes |
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.
small assert; i think you can do it in this PR. ping on green.
@@ -902,7 +902,7 @@ def _get_with(self, key): | |||
return self._get_values(key) | |||
raise | |||
|
|||
if not isinstance(key, (list, np.ndarray, Series, Index)): | |||
if not isinstance(key, (list, np.ndarray, ExtensionArray, Series, Index)): |
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.
we likely don't have many tests which do this on EAs FYI
assert res.index[-1] == "foobar" | ||
assert res._get_value("foobar", "B") == 0 | ||
float_frame._set_value("foobar", "B", 0) | ||
assert float_frame.index[-1] == "foobar" |
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.
you could assert the return value is None
assert res is s | ||
assert res.index[-1] == "foobar" | ||
assert res["foobar"] == 0 | ||
s._set_value("foobar", 0) |
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.
same here, assert return value is None
ping |
thanks |
make _set_value not return anything (the DataFrame docstring in particular is misleading)