Thuta Learning
BasicData & Databasesintermediate

Core: Series

Relax. We'll talk through this in plain words — no textbook voice.

Series — a data structure like a single column

Series is Pandas' one-dimensional data structure, similar to a list. But a Series doesn't just hold values — it also has index labels attached to it. If you want to store a single line of data — like a list of product prices, scores, or temperatures — you can use a Series.

python
import pandas as pd

prices = pd.Series([1500, 2500, 3200, 1800], name="Price")
print(prices)
print("Average price:", prices.mean())

In this code, we've converted the numbers in a list into a Series. name="Price" is the Series' label, which makes it easier to understand when generating a report. prices.mean() calculates the average price.

You should see
0 1500 1 2500 2 3200 3 1800 Name: Price, dtype: int64 Average price: 2250.0

Info

  • The 0, 1, 2, 3 on the left are the index.
  • The 1500, 2500, and so on the right are the actual values.
  • Series methods like .sum(), .mean(), .max() can be used directly.

Easy traps

  • A list and a Series might look similar, but a Series comes with many more data analysis methods. If you're going to calculate or inspect data, it's easier to keep it as a Series.