- API reference
- Series
- pandas.Series.name
pandas.Series.name#
- propertySeries.name[source]#
Return the name of the Series.
The name of a Series becomes its index or column name if it is usedto form a DataFrame. It is also used whenever displaying the Seriesusing the interpreter.
- Returns:
- label (hashable object)
The name of the Series, also the column name if part of a DataFrame.
See also
Series.rename
Sets the Series name when given a scalar input.
Index.name
Corresponding Index property.
Examples
The Series name can be set initially when calling the constructor.
>>>s=pd.Series([1,2,3],dtype=np.int64,name='Numbers')>>>s0 11 22 3Name: Numbers, dtype: int64>>>s.name="Integers">>>s0 11 22 3Name: Integers, dtype: int64
The name of a Series within a DataFrame is its column name.
>>>df=pd.DataFrame([[1,2],[3,4],[5,6]],...columns=["Odd Numbers","Even Numbers"])>>>df Odd Numbers Even Numbers0 1 21 3 42 5 6>>>df["Even Numbers"].name'Even Numbers'
On this page