🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to Pandas Notes
Topic #4

Pandas Series


What is a Series?

A Pandas Series is like a column in a table.

It is a one-dimensional array holding data of any type.

Example

import pandas as pd

a = [1, 7, 2]

myvar = pd.Series(a)

print(myvar)

Labels

If nothing else is specified, the values are labeled with their index number. First value has index 0, second value has index 1 etc.

This label can be used to access a specified value.

Example

print(myvar[0])

Create Labels

With the index argument, you can name your own labels.

Example

import pandas as pd

a = [1, 7, 2]

myvar = pd.Series(a, index = ["x", "y", "z"])

print(myvar)

When you have created labels, you can access an item by referring to the label.

Example

print(myvar["y"])

Key/Value Objects as Series

You can also use a key/value object, like a dictionary, when creating a Series.

Example

import pandas as pd

calories = {"day1": 420, "day2": 380, "day3":
  390}

myvar = pd.Series(calories)

print(myvar)

Note: The keys of the dictionary become the labels.

To select only some of the items in the dictionary, use the index argument and specify only the items you want to include in the Series.

Example

import pandas as pd

calories = {"day1": 420, "day2": 380, "day3":
  390}

myvar = pd.Series(calories,
  index = ["day1", "day2"])

print(myvar)

DataFrames

Data sets in Pandas are usually multi-dimensional tables, called DataFrames.

Series is like a column, a DataFrame is the whole table.

Example

import pandas as pd

data = {
  "calories": [420, 380, 390],
  "duration":
[50, 40, 45]
}

myvar = pd.DataFrame(data)

print(myvar)

You will learn about DataFrames in the next chapter.

Want to go beyond the notes?

Join CodingNow 2.0's Pandas course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Pandas Series – FAQs

Quick answers about learning Pandas Series in Pandas.

This free note from CodingNow 2.0 explains Pandas Series in Pandas — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Pandas topic on CodingNow 2.0, including Pandas Series, is 100% free with no signup required.
With focused practice, most students grasp Pandas Series in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now