-  
-   Notifications  You must be signed in to change notification settings 
- Fork 19.2k
COMPAT: Further Expand Compatibility with fromnumeric.py #13148
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
COMPAT: Further Expand Compatibility with fromnumeric.py #13148
Conversation
   doc/source/whatsnew/v0.18.2.txt  Outdated    
 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.
I would just make this a 1-liner. This is not something we care to advertise.
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.
Fair enough. Done.
e5465a6 to ca890e9   Compare   | Current coverage is 84.14%@@ master #13148 diff @@ ========================================== Files 138 138 Lines 50394 50409 +15 Methods 0 0 Messages 0 0 Branches 0 0 ========================================== + Hits 42409 42416 +7  - Misses 7985 7993 +8  Partials 0 0 
 | 
| @gfyoung let's maybe just disallow using numpy functions on window/groupby ops (the  this should just raise a nicer error message (say this is not supported)  | 
| Fair enough. So instead of validating as I do now, I just check if the  | 
85fa8da to 8cb265d   Compare   | not really sure how to figure out if called via numpy w/o stack inspection (not a good idea!). though you could simply just have it raise when it validates, e.g. its sort of duck like in the argument signature when called from numpy. IOW numpy is always passing dtype/out I think. So just raise a nicer error message on that (you prob need to pass a parameter to your validation routines to say hey if this is not validation, then print this nice error message; e.g. you want to say something like) """ numpy operations are not valid with groupy, use  | 
220272e to 2a5817d   Compare      pandas/compat/numpy/function.py  Outdated    
 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.
hmm not sure I like the name. maybe UnsupportedFunctionCall? and move to core.common. inherit from ValueError
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.
That works too. Will change.
659dd51 to e92aa9f   Compare      doc/source/whatsnew/v0.18.2.txt  Outdated    
 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 give a easier explanation? Users don't know what fromnumeric.py is
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.
Done.
Expands compatibility with fromnumeric.py in tslib.pyx and puts checks in window.py, groupby.py, and resample.py to ensure that pandas functions such as 'mean' are not called via the numpy library. Closes pandas-devgh-12811.
e92aa9f to eb4762c   Compare   | @jreback, @jorisvandenbossche : Made the changes, and Travis is giving the green light. Ready to merge if there is nothing else. | 
| thanks @gfyoung | 
| @gfyoung breaking with numpy master on rounding: https://travis-ci.org/pydata/pandas/jobs/131735642 | 
| Okay, I think we might need to undo this compatibility change to  # signature in tslib.pyx def round(self, freq, *args, **kwargs): ... # signature in numpy master def around(a, decimals=0, out=None): return _wrapfunc(a, 'round', decimals=decimals, out=out)When we call  | 
| ok so just revert that part of the PR | 
Follow-on to #12810 by expanding compatibility with
fromnumeric.pyin the following modules:tslib.pyxwindow.pygroupby.pyandresample.py(shared classes)Closes #12811.