-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
REF: separate indexer utilities from indexing.py #27229
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.
just some quick comments
will have a full look later
+1 on refactoring things
return is_list_like(key) and not (isinstance(key, tuple) and type(key) is not tuple) | ||
|
||
|
||
def is_scalar_indexer(indexer, arr_value) -> bool: |
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.
if possible to type pls do so (may be tricky)
I would type with Any explicity if it’s truly that
so we know this is done (meaning it has been typed)
possible to use reveal_type to figure things out here
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.
ATM I've added types for everything I had figured out with sufficient certainty. I'd rather leave it clearly-unfinished so it gets more attention than put Any if we can be more specific
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.
can you fix this doc-sring in followup and type as much as possible here
note as a post or pre-cursor to this I would form pandas/core/indexing/ and move indexing.py (and indexers.py) there as well |
Sure. Obvious preference for post-cursor. |
Hello @jbrockmendel! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2019-07-08 13:51:16 UTC |
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.
just a couple of doc-strings I think (in the first section), then can merge this
pandas/core/indexing.py
Outdated
else: | ||
return self.obj._take(indexer, axis=axis) | ||
indexer = self._convert_slice_indexer(slice_obj, axis) | ||
assert isinstance(indexer, slice), type(indexer) |
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.
prob better off to have this assert in _slice
Added one more docstring, left un-docstringed is_scalar_indexer and is_empty_indexer because I'm not totally clear on what those functions are doing (possibly an extra indentation in is_scalar_indexer? it is almost identical to the last 5 lines of is_empty_indexer) Added a note about InvalidIndexError being for geopandas. |
# Indexer Validation | ||
|
||
|
||
def check_setitem_lengths(indexer, value, values) -> None: |
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.
type
thanks. in followups we need to move / consolidate these things; also a typing pass would be helpful. |
A couple things going on here.
Medium-term goals in indexing.py