Skip to content

Conversation

@martin-martin
Copy link

The "axis" parameter of pd.concat() can take the string 'rows' as an optional way of explicitly defining the default row axis for concatenation:

import pandas as pd pd.concat([pd.DataFrame(), pd.DataFrame()], axis="rows")

Using 'rows' instead of 'index' or 0 might be more intuitive as a counterpart to 'columns'. In any case, it's a possible option, so it might be helpful to represent that in the docstring.

The proposed update in the docstring uses the suggested format based on pandas docstring guide:
https://pandas.pydata.org/docs/dev/development/contributing_docstring.html#parameter-types

For axis, the convention is to use something like:
axis : {0 or ‘index’, 1 or ‘columns’, None}, default None

  • closes #xxxx (Replace xxxx with the Github issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.
The "axis" parameter of `pd.concat()` can take the string `'rows'` as an optional way of explicitly defining the default row axis for concatenation: ``` import pandas as pd pd.concat([pd.DataFrame(), pd.DataFrame()], axis="rows") ``` Using `'rows'` instead of `'index'` or `0` might be more intuitive as a counterpart to `'columns'`. In any case, it's a possible option, so it might be helpful to represent that in the docstring. The proposed update in the docstring uses the suggested format based on pandas docstring guide: https://pandas.pydata.org/docs/dev/development/contributing_docstring.html#parameter-types >For axis, the convention is to use something like: >axis : {0 or ‘index’, 1 or ‘columns’, None}, default None
@martin-martin martin-martin mentioned this pull request Apr 22, 2022
4 tasks
Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

Thanks for the pull request.

For consistency, this should be changed everywhere axis is documented and tested as well (for the axis fixture in pandas/conftest.py)

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

-1 on this change. we have a long history of using index and columns. changing in a single place is a no-no. changing everywhere might be ok, but is going to be quite invasive.

@jreback jreback added the Reshaping Concat, Merge/Join, Stack/Unstack, Explode label May 8, 2022
@mroeschke
Copy link
Member

Thanks for the pull request but it appears that this change is unlikely to move forward with our pervasive usage of "index". Closing

@mroeschke mroeschke closed this May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reshaping Concat, Merge/Join, Stack/Unstack, Explode

3 participants