-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
CLN: index related attributes on Series/DataFrame #31953
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
CLN: index related attributes on Series/DataFrame #31953
Conversation
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.
Thanks @topper-123 generally lgtm. couple of comments. not blockers.
pandas/core/series.py
Outdated
_AXIS_NAMES = {0: "index"} | ||
_AXIS_REVERSED = False | ||
_info_axis_number = 0 | ||
_info_axis_name = _AXIS_ORDERS[_info_axis_number] |
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 think should either be a property in NDFrame or just be explicit, i.e _info_axis_name = "index"
_AXIS_REVERSED = False | ||
_info_axis_number = 0 | ||
_info_axis_name = _AXIS_ORDERS[_info_axis_number] | ||
_AXIS_LEN = len(_AXIS_ORDERS) |
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.
same
5912ae7
to
96aee4f
Compare
Ok, I've made them strings/ints. |
Yea definitely find this easier to follow as well |
Thanks @topper-123 |
Followup to #31126. IMO the current approach to adding the index related class attributes is too indirect and therefore unnecessary difficult to follow. Just adding the class attributes directly on the relevant class makes reading the code easier, IMO.
Notice that the types are already defined in pandas/core/generic.py:304-316.