-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Added alignable boolean series and its example to .loc
docs.
#35506
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
Added alignable boolean series and its example to .loc
docs.
#35506
Conversation
…loc` docs. Fixed formatting
bcfe1ea
to
4014a60
Compare
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.
thanks @MJafarMashhadi
A few small comments. Otherwise lgtm
pandas/core/indexing.py
Outdated
@@ -255,6 +255,8 @@ def loc(self) -> "_LocIndexer": | |||
|
|||
- A boolean array of the same length as the axis being sliced, | |||
e.g. ``[True, False, True]``. | |||
- An alignable boolean series. Index of the key will be aligned before |
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.
series should be capitalized
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.
nit-pick: 'The index of the key'
pandas/core/indexing.py
Outdated
@@ -264,6 +266,8 @@ def loc(self) -> "_LocIndexer": | |||
------ | |||
KeyError | |||
If any items are not found. | |||
IndexingError | |||
If an indexed key is passed and its index is unalignable to the 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.
nit-pick: 'unalignable to the frame index'
pandas/core/indexing.py
Outdated
@@ -319,6 +323,13 @@ def loc(self) -> "_LocIndexer": | |||
max_speed shield | |||
sidewinder 7 8 | |||
|
|||
Alignable boolean series: |
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.
series should be capitalized
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.
great
Thanks for the review! |
Thanks @MJafarMashhadi |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
I'm just not sure if I needed to add
IndexingError
to raises section. Added it to be safe, will remove if it's unnecessary.Also, when someone uses
df.loc[df['col'] > 0]
it really is the same under the hood,df['col'] > 0
is a boolean series with an alignable index. So there might be some overlap?