Description
The recurring pattern {0: 'index', 1: 'columns', 2: 'origin', 3: 'development'}` is used to look up and map axes values, and validate arguments.
It's not applied consistently though, there's a spot in pandas.py where we have the keys and values reversed in order to extract the integer value:
{"index": 0, "columns": 1, "origin": 2, "development": 3}
Anyhow, keeping the axes in a central location such as __init__.py will improve maintainability and make it clear which axes are supported, as well as solidify the text to integer mapping.
Is your feature request aligned with the scope of the package?
Describe the solution you'd like, or your current workaround.
I propose a tuple: __axes__ = ('index', 'columns', 'origin', 'development'). This is immutable and can be used to lookup values in both directions:
print(__axes__[2])
'origin'
print(__axes__.index('origin'))
'2'
Do you have any additional supporting notes?
Labeling this as a discussion, to see if there's a better way to do this. I don't really like how a tuple has a method called index which can be confused with the Triangle's index.
Will drop the discussion label and set status to ready to be picked up once this is decided.
Would you be willing to contribute this ticket?
Description
The recurring pattern
{0: 'index', 1: 'columns', 2: 'origin', 3: 'development'}` is used to look up and map axes values, and validate arguments.It's not applied consistently though, there's a spot in pandas.py where we have the keys and values reversed in order to extract the integer value:
{"index": 0, "columns": 1, "origin": 2, "development": 3}Anyhow, keeping the axes in a central location such as
__init__.pywill improve maintainability and make it clear which axes are supported, as well as solidify the text to integer mapping.Is your feature request aligned with the scope of the package?
Describe the solution you'd like, or your current workaround.
I propose a tuple:
__axes__ = ('index', 'columns', 'origin', 'development'). This is immutable and can be used to lookup values in both directions:Do you have any additional supporting notes?
Labeling this as a discussion, to see if there's a better way to do this. I don't really like how a tuple has a method called
indexwhich can be confused with the Triangle's index.Will drop the discussion label and set status to ready to be picked up once this is decided.
Would you be willing to contribute this ticket?