Skip to content

Informatics Practices · Ch 2 — Data Handling using Pandas – I

Series

2.2

Series

A Series is the most basic data structure in Pandas. Think of it as a single column of data, like one column in an Excel spreadsheet. It holds a sequence of values, and every value in that sequence has a label attached to it. That label is called the index.

By default, the index is just a set of numbers starting from 0 and going up — 0, 1, 2, 3, and so on. But you are not stuck with numbers. You can assign any other data type as the index, such as strings (text labels) or dates. This flexibility is what makes a Series powerful for real-world data.

A Series can hold values of any single data type — integers, floats, strings, lists, or even more complex objects. All the values in one Series are usually of the same type, though Pandas does not strictly enforce this.

Note

A good way to picture a Series is to imagine a column in a spreadsheet. The column header is like the Series name, the cells are the values, and the row numbers are the index labels.

Here is a simple example from the textbook. Suppose we have a Series containing the names of five students:

IndexValue
0Arnab
1Samridhi
2Ramit
3Divyam
4Kritika