From the course: Python for Data Visualization
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Convert pandas DataFrames - Python Tutorial
From the course: Python for Data Visualization
Convert pandas DataFrames
- [Instructor] When working with Pandas DataFrames, you'll oftentimes find you want to convert them to NumPy arrays or Python dictionaries. The reason why is because certain libraries prefer NumPy rays or Python dictionaries as inputs to their methods as opposed to Pandas DataFrames. In this video, we'll work with the car loan dataset again, and we're going to look at the first five rows. There are two ways to convert Pandas DataFrames to NumPy arrays. The first approach is to use the two underscore NumPy method, and what this outputs is a NumPy array. The second approach is to use the values attribute, and this also produces a NumPy array. I should note that either of these approaches works just as well as the other. You can also convert Pandas DataFrames to Python dictionaries. You can do this by using the two underscore dict method, and the reason why you'd want to do this versus convert your Pandas DataFrame to a NumPy…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Introduction to pandas1m 30s
-
(Locked)
Create sample data3m 50s
-
(Locked)
Load sample data2m 17s
-
(Locked)
Basic operations1m 57s
-
(Locked)
Simplify with slicing4m 12s
-
(Locked)
Filter and clean data5m 39s
-
(Locked)
Rename and delete columns3m 16s
-
(Locked)
Aggregate functions2m 39s
-
(Locked)
Identify missing data3m 41s
-
(Locked)
Remove or fill in missing data5m 3s
-
(Locked)
Convert pandas DataFrames1m 15s
-
(Locked)
Export pandas DataFrames1m 28s
-
(Locked)
-
-
-