Skip to content

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

Merged

Conversation

ShaharNaveh
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

Copy link
Member

@datapythonista datapythonista left a 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!

@simonjayhawkins simonjayhawkins added this to the 1.1 milestone Mar 31, 2020
@ShaharNaveh
Copy link
Member Author

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
Copy link
Member

@simonjayhawkins simonjayhawkins Apr 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

@simonjayhawkins simonjayhawkins left a 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

@ShaharNaveh
Copy link
Member Author

ping @simonjayhawkins

@simonjayhawkins simonjayhawkins merged commit 02a134b into pandas-dev:master Apr 3, 2020
@simonjayhawkins
Copy link
Member

Thanks @MomIsBestFriend

@ShaharNaveh ShaharNaveh deleted the DOC-DocTests-core-ops branch April 3, 2020 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants