pandas.Series.set_axis — pandas 3.0.0rc0+33.g1fd184de2a documentation (original) (raw)
Series.set_axis(labels, *, axis=0, copy=<no_default>)[source]#
Assign desired index to given axis.
Indexes for row labels can be changed by assigning a list-like or Index.
Parameters:
labelslist-like, Index
The values for the new index.
axis{0 or ‘index’}, default 0
The axis to update. The value 0 identifies the rows. For Seriesthis parameter is unused and defaults to 0.
copybool, default False
This keyword is now ignored; changing its value will have no impact on the method.
Deprecated since version 3.0.0: This keyword is ignored and will be removed in pandas 4.0. Since pandas 3.0, this method always returns a new object using a lazy copy mechanism that defers copies until necessary (Copy-on-Write). See the user guide on Copy-on-Writefor more details.
Returns:
Series
An object of type Series.
Examples
s = pd.Series([1, 2, 3]) s 0 1 1 2 2 3 dtype: int64
s.set_axis(['a', 'b', 'c'], axis=0) a 1 b 2 c 3 dtype: int64