-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
DOC: Fix examples in pandas/core/ops/ #33176
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
DOC: Fix examples in pandas/core/ops/ #33176
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, thanks @MomIsBestFriend
I think in a follow up would be good to have a single call for all the doctests. Not sure why we group few cases, then call some files individually...
Also, if you keep fixing tests, may be you can fix one directory at a time. So, for example, instead of having to call evey file in pandas/core/arrays
separetely, we can just have one call for the whole directory.
Ideally, at some point we simply want to have a call to pytest -q --doctest-modules pandas
Thanks!
@datapythonista Exactly, this is what I am aiming for. And about the reason why there are "groupings" of, some of them are there for legacy reasons and the other reason is to have it as a "placeholder", I was afraid that even if a file is fixed, overtime it will become "wrong" agian, so this is just putting things in the "safe" place. |
>>> y = 0 # int 0; numpy behavior is different with float | ||
>>> result = x / y | ||
>>> result = x // y |
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.
pandas/pandas/core/ops/missing.py
Lines 164 to 167 in 6f93898
elif op is operator.floordiv: | |
# Note: no need to do this for truediv; in py3 numpy behaves the way | |
# we want. | |
result = mask_zero_div_zero(left, right, result) |
maybe update the docstring to reflect this change.
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.
@simonjayhawkins I'm not sure I understand what to update, can you 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.
pandas/pandas/core/ops/missing.py
Lines 73 to 76 in 6f93898
def mask_zero_div_zero(x, y, result): | |
""" | |
Set results of 0 / 0 or 0 // 0 to np.nan, regardless of the dtypes | |
of the numerator or the denominator. |
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 @MomIsBestFriend lgtm. ping on green
ping @simonjayhawkins |
Thanks @MomIsBestFriend |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff