Lecture

Creating and Inspecting Series and DataFrames

Now that you’ve been introduced to Pandas, it’s time to start creating real data structures.

In this lesson, you’ll learn how to build Series and DataFrames from Python lists and dictionaries.

These objects allow you to store, label, and organize data efficiently — and Pandas makes the process simple and intuitive.

Series

A Series is a one-dimensional labeled array — similar to a single column in a spreadsheet.

Below is an example of creating a Series from a list.

Build a Series and a DataFrame
import pandas as pd # Create a Series of daily step counts steps = pd.Series([8000, 9200, 10200], name="Steps") print("Steps Series:", steps)

Series are useful for storing and manipulating single columns of data.


DataFrame

A DataFrame is a two-dimensional labeled table with rows and columns — much like a spreadsheet.

Below is an example of creating a DataFrame from a dictionary.

Build a Series and a DataFrame
import pandas as pd # Create a Series of daily step counts steps = pd.Series([8000, 9200, 10200], name="Steps") # Create a DataFrame of sales records sales = pd.DataFrame({ "Product": ["Book", "Pen", "Notebook"], "Price": [12.99, 1.50, 4.75] }) print("Steps Series:", steps) print("Sales DataFrame:", sales)

DataFrames are useful for storing and manipulating multiple columns of data.

Quiz
0 / 1

Which Pandas function is used to preview the first few rows of a DataFrame?

.describe()

.info()

.head()

.tail()

Lecture

AI Tutor

Design

Upload

Notes

Favorites

Help