← Back to Pandas Course | Chapter 1: Getting Started | Lesson 4 of 7

Series basics

A Series is a single labelled column of data: values plus an index that names each one.

In this page:

  1. Series basics
Syntax
python
s = pd.Series([value1, value2, value3], index=[label1, label2, label3])

Series basics

A Series is a one-dimensional array with an index. If you do not supply an index it uses 0, 1, 2 and so on. It holds one dtype and supports fast vectorized maths.

Note: A DataFrame column is itself a Series.

Example: Series basics

python
import pandas as pd

s = pd.Series([90, 85, 70], index=["math", "art", "music"])
print(s)
print("art:", s["art"])
print(s * 2)

# Output:
# math     90
# art      85
# music    70
# dtype: int64
# art: 85
# math     180
# art      170
# music    140
# dtype: int64
Related Topics
Common Mistakes
  1. Forgetting the index labels exist
  2. Assuming a Series behaves exactly like a list
  3. Mixing types and getting object dtype
Chapter Summary
  • A Series is values plus an index
  • The default index is 0..n-1
  • It holds one dtype
  • Maths is vectorized
🔒

Chapter Quiz — Complete all 7 topics to unlock

0/7 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.