Skip to content

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

Merged
merged 2 commits into from
Feb 14, 2020

Conversation

topper-123
Copy link
Contributor

@topper-123 topper-123 commented Feb 13, 2020

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.

Copy link
Member

@simonjayhawkins simonjayhawkins left a 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.

_AXIS_NAMES = {0: "index"}
_AXIS_REVERSED = False
_info_axis_number = 0
_info_axis_name = _AXIS_ORDERS[_info_axis_number]
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

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

same

@simonjayhawkins simonjayhawkins added this to the 1.1 milestone Feb 13, 2020
@topper-123 topper-123 force-pushed the cln_index_related_attributes branch from 5912ae7 to 96aee4f Compare February 13, 2020 17:45
@topper-123
Copy link
Contributor Author

Ok, I've made them strings/ints.

@WillAyd
Copy link
Member

WillAyd commented Feb 14, 2020

Yea definitely find this easier to follow as well

@WillAyd WillAyd merged commit 67fc9e0 into pandas-dev:master Feb 14, 2020
@WillAyd
Copy link
Member

WillAyd commented Feb 14, 2020

Thanks @topper-123

@topper-123 topper-123 deleted the cln_index_related_attributes branch February 14, 2020 21:50
roberthdevries pushed a commit to roberthdevries/pandas that referenced this pull request Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants