Python Pandas Series: index

Series is a 1-D ndarray with axis labels. The label should be of a hashable type. The data aligns automatically by labels or index. The index can be generated automatically.

Pandas Series.index attribute is used to get or set the index labels of the given Series object. It is a sequence of numbers. It starts with 0 and end at an integer that is one less than the length of the entire sequence.


import pandas as pd


a.index=['Word 1','Word 2','Word 3','Word 4','Word 5','Word 6']


Word 1    P
Word 2    Y
Word 3    T
Word 4    H
Word 5    O
Word 6    N
dtype: object
Tue, 11/02/2021 - 20:48

Authored by

Devanshi, is working as a Data Scientist with iVagus. She has expertise in Python, NumPy, Pandas and other data science technologies.