-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
REF get-axis-number #43263
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 get-axis-number #43263
Conversation
Hello @ForthenchoPacino! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2021-08-28 04:40:43 UTC |
pandas/core/generic.py
Outdated
@@ -23,6 +23,7 @@ | |||
) | |||
import warnings | |||
import weakref | |||
from pandas import 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.
why?
elif axis in [1, "columns"]: | ||
if DataFrame()._get_axis_number(axis)==0: | ||
result = data.apply(func, axis=0, **kwargs) | ||
if DataFrame()._get_axis_number(axis)==1: |
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.
why?
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.
don't make changes to style.py
this already has PRs fixing this. please revert.
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.
aight. on it
just to confirm, though, were my changes correct? or were they unnecessary?
What is the motivation for any of this? |
Why, as in? Like, is it a really inefficient method, or was the whole thing not needed? |
@@ -488,7 +488,7 @@ def test_rolling_axis_count(axis_frame): | |||
|
|||
axis = df._get_axis_number(axis_frame) | |||
|
|||
if axis in [0, "index"]: | |||
if DataFrame()._get_axis_number(axis)==0: |
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.
axis
has already been reduced to an integer in line 489. Sufficient for if axis == 0
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.
Ah. So, has this specific edit been rendered unnecessary?
@@ -995,7 +995,7 @@ def test_consistency_for_boxed(box, int_frame_const_col): | |||
|
|||
|
|||
def test_agg_transform(axis, float_frame): | |||
other_axis = 1 if axis in {0, "index"} else 0 | |||
other_axis = 1 if DataFrame()._get_axis_number(axis)==0 else 0 |
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.
the issue has been revised to avoid fixing test
files. Too many new contributors were making mistakes by changing the nature of what was being tested.
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.
So, no touching test files, then?
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.
dont edit test files.
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.
Aight. Won't. Thanks for telling. I'll revert the changes
@@ -547,7 +547,7 @@ def test_groupby_level_index_names(self, axis): | |||
df = DataFrame({"exp": ["A"] * 3 + ["B"] * 3, "var1": range(6)}).set_index( | |||
"exp" | |||
) | |||
if axis in (1, "columns"): | |||
if DataFrame()._get_axis_number(axis)==0: |
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.
you can do this here, but use existing objects such as df._get_axis_number(axis) == 1
. Also note you have got the 0 and 1 wrong here.
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.
Ah. Thanks for point that out, I'll correct it and re-commit
Thanks @ForthenchoPacino for the PR. I think #43121 fixed the issue for pandas/io/formats/style.py and the other changes are to files in pandas/tests, see #43048 (comment). so closing. |
Uh oh!
There was an error while loading. Please reload this page.