Pandas Series is a one-dimensional labeled array capable of holding data of any type (integer, string, float, python objects, etc.). Labels need not be unique but must be a hashable type.
Let's discuss different ways to access the elements of given Pandas Series.
First create a Pandas Series.
Output:
👁 Image
Example #1: Get the first element of series
Output:
👁 Image
Example #2: Access multiple elements by providing position of item
Output:
👁 Image
Example #3: Access first 5 elements in Series
Output:
👁 Image
Example #4: Get last 10 elements in Series
Output:
👁 Image
Example #5: Access multiple elements by providing label of index