In [1]:
import numpy as np
import pandas as pd
from pandas import Series, DataFrame

In [3]:
my_ser = Series([1,2,3,4], index=['A','B','C','D'])

In [4]:
my_ser


Out[4]:
A    1
B    2
C    3
D    4
dtype: int64

In [5]:
my_index = my_ser.index

In [6]:
my_index


Out[6]:
Index(['A', 'B', 'C', 'D'], dtype='object')

In [8]:
my_index[2]


Out[8]:
'C'

In [9]:
my_index[2:]


Out[9]:
Index(['C', 'D'], dtype='object')

In [10]:
my_index[0] = 'C'
# TypeError: Index does not support mutable operations


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-10-e99a295c7488> in <module>()
----> 1 my_index[0] = 'C'

C:\Program Files\Anaconda3\lib\site-packages\pandas\indexes\base.py in __setitem__(self, key, value)
   1243 
   1244     def __setitem__(self, key, value):
-> 1245         raise TypeError("Index does not support mutable operations")
   1246 
   1247     def __getitem__(self, key):

TypeError: Index does not support mutable operations

In [ ]: