Skip to content
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

implement masked_arith_op to de-duplicate ops code #22182

Merged
merged 5 commits into from
Aug 10, 2018

Conversation

jbrockmendel
Copy link
Member

ATM _arith_method_SERIES and _arith_method_FRAME have really similar fallback code. This de-duplicates those.

  • passes git diff upstream/master -u -- "*.py" | flake8 --diff

@codecov
Copy link

codecov bot commented Aug 3, 2018

Codecov Report

Merging #22182 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #22182      +/-   ##
==========================================
+ Coverage   92.08%   92.08%   +<.01%     
==========================================
  Files         169      169              
  Lines       50704    50695       -9     
==========================================
- Hits        46691    46683       -8     
+ Misses       4013     4012       -1
Flag Coverage Δ
#multiple 90.49% <100%> (ø) ⬆️
#single 42.34% <7.69%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/ops.py 96.56% <100%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 475e391...d8ab2a5. Read the comment docs.

@gfyoung gfyoung added Refactor Internal refactoring of code Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff labels Aug 3, 2018
op : binary operator
"""
xrav = x.ravel() # 2D compat
assert isinstance(x, (np.ndarray, ABCSeries)), type(x)
Copy link
Member

Choose a reason for hiding this comment

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

Can we provide a more informative error message than just the type of x?

Copy link
Member

Choose a reason for hiding this comment

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

This comment BTW applies to all of the assert statements that you added.

@jreback
Copy link
Contributor

jreback commented Aug 9, 2018

looks ok, if you can comment a bit more, this consolidates a gnarly bit of code, which is full of special cases. and rebase.

@jbrockmendel
Copy link
Member Author

this consolidates a gnarly bit of code, which is full of special cases

Yah. A bunch of it we'll be able to simplify after #22163, #22019, and the not-yet-written third PR in that sequence make a bunch of it unnecessary.

@jreback jreback added this to the 0.24.0 milestone Aug 10, 2018
@jreback jreback merged commit 97478b0 into pandas-dev:master Aug 10, 2018
@jreback
Copy link
Contributor

jreback commented Aug 10, 2018

thanks

@jbrockmendel jbrockmendel deleted the ops_mask branch August 10, 2018 17:20
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Refactor Internal refactoring of code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants