- HD
- 720p
- 540p
- 360p
- 0.50x
- 0.75x
- 1.00x
- 1.25x
- 1.50x
- 1.75x
- 2.00x
We hope you enjoyed this lesson.
Cool lesson, huh? Share it with your friends
About this lesson
DataFrames are like spreadsheets, and in this video, we start building and using them.
Exercise files
Download this lesson’s related exercise files.
Pandas DataFrames57.2 KB Pandas DataFrames - Solution
55.7 KB
Quick reference
Pandas DataFrames
DataFrames are the main workhorse of Pandas that we'll be using throughout the rest of the course.
When to use
You'll use DataFrames whenever you want to visualize data in spreadsheet format.
Instructions
To create Random Data, import randn:
from numpy.random import randn
To create dummy random data:
my_data = randn(6,2)
Where randn(rows,columns).
To create a DataFrame, first designate rows, and columns, then put it all together:
my_data = randn(4,3)
my_rows = ["A", "B", "C", "D"]
my_cols = ["Mon", "Tues", "Wed"]
my_df = pd.DataFrame(my_data, my_rows, my_cols)
Hints & tips
- from numpy.random import randn
- Random Data: my_data = randn(6,2)
- Create DataFrame: my_df = pd.DataFrame(my_data, my_rows, my_cols)
Lesson notes are only available for subscribers.