-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
REF/TYP: define NDFrame numeric methods non-dynamically #37017
Conversation
i've spent more time than i'd like to admit looking into this. tried altering the doc decorator to allow templates but it turns out easier to pass the actually docstring to the decorator instead of the function. https://github.com/jbrockmendel/pandas/compare/typ-generic-3...simonjayhawkins:docs?expand=1 for a potential solution to any and all. (i've merged master so the diff is not so clear) that sits on top of this PR. of course, now that the methods are in both DataFrame and Series, don't need the common examples. |
thats a nice touch putting the shared bits into Did the |
not used in any/all, |
cls.any = _make_logical_function( | ||
cls, | ||
"any", | ||
@doc( |
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.
is the point of leaving these here, to make the doc strings work / make mypy happy? e.g. you defined them above an now you are re-defining them for Series/DataFrame
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.
it'd be nice to have a less-verbose way of pinning the docstrings. i haven't had any luck so far at making that work.
i guess this comment explains?
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.
redefining to get the docstrings right. im not wild about this either
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.
yah. im going to try @simonjayhawkins's suggestion, so let's stick a pin in this, ill gentle-ping when ready
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.
redefining to get the docstrings right. im not wild about this either
that was my initial reaction. but am now more comfortable that this could be dealt with in a follow-on
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.
either way, lgtm.
merging to unblock a doc-issue, pls followup as needed |
* REF/TYP: use OpsMixin for arithmetic methods * REF: separate arith_method_FRAME from flex_arith_method_FRAME * whatsnew * REF/TYP: use OpsMixin for logical methods (#36964) * TST: insert 'match' to bare pytest raises in pandas/tests/tools/test_to_datetime.py (#37027) * TST: insert 'match' to bare pytest raises in pandas/tests/test_flags.py (#37026) Co-authored-by: Rajat Bishnoi <[email protected]> * TYP: generic, series, frame (#36989) * CI: pin pymysql #36465 (#36847) * CI: unpin sql to verify the bugs #36465 * CI: pin sqlalchemy * CI: pin pymsql * CI: pin sqlalchemy * CI: pin pymysql * CI: pin pymysql * CI: add note * CLN/REF: de-duplicate DatetimeTZBlock.setitem (#37019) * REF/TYP: define NDFrame numeric methods non-dynamically (#37017) * CLN: require td64 in TimedeltaBlock (#37018) * BUG: Raise ValueError instead of bare Exception in sanitize_array (#35769) * CLN: collected cleanups, warning suppression in tests (#37021) * REF/TYP: use OpsMixin for DataFrame * CLN: remove get_op_name * mypy fixup * de-privatize Co-authored-by: krajatcl <[email protected]> Co-authored-by: Rajat Bishnoi <[email protected]> Co-authored-by: Fangchen Li <[email protected]> Co-authored-by: Micah Smith <[email protected]>
* REF/TYP: use OpsMixin for arithmetic methods * REF: separate arith_method_FRAME from flex_arith_method_FRAME * whatsnew * REF/TYP: use OpsMixin for logical methods (pandas-dev#36964) * TST: insert 'match' to bare pytest raises in pandas/tests/tools/test_to_datetime.py (pandas-dev#37027) * TST: insert 'match' to bare pytest raises in pandas/tests/test_flags.py (pandas-dev#37026) Co-authored-by: Rajat Bishnoi <[email protected]> * TYP: generic, series, frame (pandas-dev#36989) * CI: pin pymysql pandas-dev#36465 (pandas-dev#36847) * CI: unpin sql to verify the bugs pandas-dev#36465 * CI: pin sqlalchemy * CI: pin pymsql * CI: pin sqlalchemy * CI: pin pymysql * CI: pin pymysql * CI: add note * CLN/REF: de-duplicate DatetimeTZBlock.setitem (pandas-dev#37019) * REF/TYP: define NDFrame numeric methods non-dynamically (pandas-dev#37017) * CLN: require td64 in TimedeltaBlock (pandas-dev#37018) * BUG: Raise ValueError instead of bare Exception in sanitize_array (pandas-dev#35769) * CLN: collected cleanups, warning suppression in tests (pandas-dev#37021) * REF/TYP: use OpsMixin for DataFrame * CLN: remove get_op_name * mypy fixup * de-privatize Co-authored-by: krajatcl <[email protected]> Co-authored-by: Rajat Bishnoi <[email protected]> Co-authored-by: Fangchen Li <[email protected]> Co-authored-by: Micah Smith <[email protected]>
* REF/TYP: use OpsMixin for arithmetic methods * REF: separate arith_method_FRAME from flex_arith_method_FRAME * whatsnew * REF/TYP: use OpsMixin for logical methods (pandas-dev#36964) * TST: insert 'match' to bare pytest raises in pandas/tests/tools/test_to_datetime.py (pandas-dev#37027) * TST: insert 'match' to bare pytest raises in pandas/tests/test_flags.py (pandas-dev#37026) Co-authored-by: Rajat Bishnoi <[email protected]> * TYP: generic, series, frame (pandas-dev#36989) * CI: pin pymysql pandas-dev#36465 (pandas-dev#36847) * CI: unpin sql to verify the bugs pandas-dev#36465 * CI: pin sqlalchemy * CI: pin pymsql * CI: pin sqlalchemy * CI: pin pymysql * CI: pin pymysql * CI: add note * CLN/REF: de-duplicate DatetimeTZBlock.setitem (pandas-dev#37019) * REF/TYP: define NDFrame numeric methods non-dynamically (pandas-dev#37017) * CLN: require td64 in TimedeltaBlock (pandas-dev#37018) * BUG: Raise ValueError instead of bare Exception in sanitize_array (pandas-dev#35769) * CLN: collected cleanups, warning suppression in tests (pandas-dev#37021) * REF/TYP: use OpsMixin for DataFrame * CLN: remove get_op_name * mypy fixup * de-privatize Co-authored-by: krajatcl <[email protected]> Co-authored-by: Rajat Bishnoi <[email protected]> Co-authored-by: Fangchen Li <[email protected]> Co-authored-by: Micah Smith <[email protected]>
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
cc @simonjayhawkins along with #36989 this gets most of the generic.py mypy complaints (notwithstanding complaints about
cls.foo = foo
that can be addressed by changing tosetattr(cls, "foo", foo)
.it'd be nice to have a less-verbose way of pinning the docstrings. i haven't had any luck so far at making that work.