Skip to content

DOC: default axis is unspecified for DataFrame (and even some Series) operations #48561

Open
@toobaz

Description

@toobaz

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.max.html

Documentation problem

The docs for pd.DataFrame.max() state, about the axis argument:

axis{index (0), columns (1)}

    Axis for the function to be applied on.

The docs for pd.DataFrame.std() don't even include the explanatory sentence.

Instead, the docs for pd.DataFrame.cummin() have

axis{0 or ‘index’, 1 or ‘columns’}, default 0

    The index or the name of the axis. 0 is equivalent to None or ‘index’.

... which I think is good (also notice the more understandable explanation of the equivalence between numbers and descriptions), except that the default in the signature is None, not 0, and that I would replace the last sentence with None is equivalent to 0 or index.

Suggested fix for documentation

Simplest solution: specify, in all these signatures, that default: None and that None corresponds to 0 (see above for cummin()).

My preferred solution, set the default to 0 (rather than None), specify that default 0, start deprecating None (which is likely not used anywhere anyway). But given that the current max() signature states axis=NoDefault.no_default, which I don't know the meaning of, maybe there is something I am missing? Still, the signature for std() looks similar except that axis=None (the axis docs still provide no default), and conceptually the kind of requested data manipulation is similar...

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocsNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions