Programming Essentials Python - Overview of Pandas Libraries - Overview of Series

Pandas Series is a one-dimensional labeled array capable of holding any data type. It is similar to one column in an excel spreadsheet or a database table. We can create Series by using a dictionary.

import pandas as pd

d = {"JAN": 10, "FEB": 15, "MAR": 12, "APR": 16}
s = pd.Series(d)
s

Accessing Elements in Series

You can access elements in a Series using indexes and slices.

s['FEB']  # Accessing element by label
s[0]  # Accessing element by position
s[1:3]  # Slicing the Series

Series Operations

You can perform various operations on Series like summing up the values.

s.sum()  # Sum of all the values in the Series

Creating Series from Lists

You can create a Series from a list as well.

l = [10, 15, 12, 16]
l_s = pd.Series(l)
l_s

In this hands-on task, you can practice creating a Series using different methods and accessing elements within it.

  1. Create a Series using your own data.
  2. Access elements by label and position in the Series created.

Conclusion

In this article, we explored the basics of Pandas Series and how to create and manipulate Series objects in Python. It’s a fundamental data structure in Pandas that forms the building blocks for more advanced data processing tasks. Practice using Series in different scenarios to master this concept effectively.

Overview of Series

The video provided below explains the key concepts related to Pandas Series and demonstrates how to work with them effectively. Watch the video to deepen your understanding.

Placeholder for the video: Watch the video here


I’ll replace the placeholder with the actual link once you provide it.

Watch the video tutorial here