pandas 1.4.2

ParametersReturns
_set_axis_name(self, name, axis=0, inplace=False)

Parameters

name : str or list of str

Name(s) to set.

axis : {0 or 'index', 1 or 'columns'}, default 0

The axis to set the label. The value 0 or 'index' specifies index, and the value 1 or 'columns' specifies columns.

inplace : bool, default False

If :None:None:`True`, do operation inplace and return None.

Returns

Series, DataFrame, or None

The same type as the caller or :None:None:`None` if :None:None:`inplace` is :None:None:`True`.

Set the name(s) of the axis.

See Also

DataFrame.rename

Alter the axis labels of :None:class:`DataFrame`.

Index.rename

Set the name of :None:class:`Index` or :None:class:`MultiIndex`.

Series.rename

Alter the index labels or set the index name of :None:class:`Series`.

Examples

This example is valid syntax, but we were not able to check execution
>>> df = pd.DataFrame({"num_legs": [4, 4, 2]},
...  ["dog", "cat", "monkey"])
... df num_legs dog 4 cat 4 monkey 2
This example is valid syntax, but we were not able to check execution
>>> df._set_axis_name("animal")
        num_legs
animal
dog            4
cat            4
monkey         2
This example is valid syntax, but we were not able to check execution
>>> df.index = pd.MultiIndex.from_product(
...  [["mammal"], ['dog', 'cat', 'monkey']])
... df._set_axis_name(["type", "name"]) num_legs type name mammal dog 4 cat 4 monkey 2
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/generic.py#1336
type: <class 'function'>
Commit: