From the course: Python Functions for Data Science

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Modify pandas objects

Modify pandas objects - Python Tutorial

From the course: Python Functions for Data Science

Start my 1-month free trial

Modify pandas objects

- [Instructor] Oftentimes, when working with pandas objects, you'll want to make changes to the pandas objects to suit the needs of your task. There are a lot of ways to do this. In this video, I'll be highlighting some of the main functions that are used to modify pandas objects. Let's say that I have a variable named Grades, containing a pandas data frame, and the data frame consists of students scores across five exams. I've displayed grades here, as you may have noticed, the grade column has missing values. Note that NaN denotes a missing value. Let's say that I want to fill the missing values in the grade column with zeros, I can use the fillna function, and it would look like this. I've displayed grades now and as you can see, the NaNs are gone and have been replaced with zeros. Next, say I want to drop the student ID column from the grades data frame, to do this I can use the drop function. It would look…

Contents