In Pandas we can access data from the series by using various methods. We can easily access the elements of series by referring to its index number. Index Number must be an integer.
We can also perform slicing to access multiple elements from a series. Slicing Operations is perfromed on the series by using colon (:). Slicing of series is similar to list slicing . It follows the same format.
To print elements within a range use [Start Index:End Index].
import pandas as pd data = ['P','R','O','G','R','A','M','S','B','U','Z','Z'] series_data = pd.Series(data)
0 P 1 R 2 O 3 G 4 R dtype: object
6 M 7 S 8 B 9 U 10 Z 11 Z dtype: object
6 M 7 S 8 B 9 U 10 Z dtype: object