Let’s discuss the different ways to access elements of this Pandas Series.
First, create a Pandas Series.
|
Output:
Example # 1: Get the first element of the series
|
Output:
Example # 2: accessing multiple elements by providing element position
|
Output:
Example # 3: Accessing the first 5 elements in a series
|
Output:
Example # 4: Get the last 10 items in a series
|
Output:
Example # 5: Accessing multiple items by providing an index label
|
Output:
< img src = "http://espressocode.top/images/contpobanutrtranren494438.jpg" />