The Series: Pandas
A Pandas Series is a one-dimensional labelled array — a single column of data where every value is paired with an index label, like a smarter, faster version of a Python list.
Learn The Series: Pandas in our free Pandas course — a beginner-friendly interactive lesson with worked examples, a practice exercise and a quick reference.
Part of the free Pandas course at LearnCodingFast — hands-on lessons with examples you run in your browser, plus practice exercises and a quick quiz.
The Series is the foundation of everything in Pandas: every column of a DataFrame is a Series. Master it here and the DataFrame will feel natural.
The simplest way to make a Series is to pass a Python list to pd.Series() . Pandas adds a default integer index (0, 1, 2, ...) and infers a single dtype for all the values.
Printing a Series shows two columns: the index on the left and the values on the right, with the dtype noted at the bottom.
The index is what makes a Series special. Instead of bare positions, you can give each value a meaningful label :
If you build a Series from a dictionary , the keys become the index labels and the values become the data — automatically:
You can pull values out of a Series two ways — by label or by position :
And three handy attributes describe the Series itself:
Because a Series is backed by NumPy, math applies to every element at once — no loop needed. This is called a vectorised operation:
You can also keep only the values that match a condition. A comparison like s > 20 produces a Series of True/False, and feeding that back into s[...] keeps only the True rows — this is boolean indexing :
✅ Fix: match the label exactly, or check with s.index .
✅ Fix: use s.iloc[0] for position and s.loc["label"] for labels — explicit is safer.
Use a Series and vectorised math to convert Celsius to Fahrenheit:
Lesson 2 complete — you've met the Series!
You can create a Series from lists and dicts, work with the index, access values by label and position, do vectorised math, and filter with boolean masks.
🚀 Up next: The DataFrame — stack many Series side by side to build Pandas' core 2-D table of rows and columns.
Practice quiz
A pandas Series is best described as what?
- A one-dimensional labeled array
- A two-dimensional table
- A dictionary of frames
- An immutable tuple
Answer: A one-dimensional labeled array. A Series is a 1-D array with an index of labels.
How do you create a Series from the list [1, 2, 3]?
pd.Series([1, 2, 3]) builds a Series from the list.
When you build a Series from a dict, what becomes the index?
- Integers 0,1,2
- The values
- The dict's keys
- Nothing
Answer: The dict's keys. Dict keys become the Series index and values become the data.
Given s = pd.Series([10,20,30], index=['a','b','c']), what is s['a']?
- 20
- 'a'
- 30
- 10
Answer: 10. Label 'a' maps to the first value, 10.
What is the default index for pd.Series([1, 2, 3])?
- 0, 1, 2
- 1, 2, 3
- a, b, c
- The values themselves
Answer: 0, 1, 2. Without an index argument, pandas uses a RangeIndex 0,1,2.
How do you access a Series element by integer POSITION?
iloc is position-based, so s.iloc[0] returns the first value.
What does pd.Series([1, 2, 3]) * 2 produce?
Arithmetic on a Series is vectorised: each element doubles.
How do you keep only Series values greater than 1?
- s.filter(>1)
- s.where_gt(1)
- s.keep(1)
A boolean mask s[s > 1] keeps elements where the condition is True.
What is the dtype of pd.Series([1, 2, 3])?
- int64
- object
- float64
- str
Answer: int64. A Series of whole numbers gets the int64 dtype.
Which attribute returns the underlying NumPy array of a Series?
- s.array_data
- s.values
- s.numpy
- s.raw
Answer: s.values. s.values returns the data as a NumPy ndarray.