From the course: Python in Excel: Working with pandas DataFrames
Unlock the full course today
Join today to access over 23,300 courses taught by industry experts.
Manipulating DataFrames
From the course: Python in Excel: Working with pandas DataFrames
Manipulating DataFrames
- [Instructor] To change data in a data frame or add new column, we can use the lock and I lock attributes that we are already familiar with. Let's get started. Datasets often have issues, so let's assume that John over here in row 11 has actually completed the course, but for some reason the data just won't reflect that properly. Luckily, we can fix this in our data frame. As usual, we start in cell K1 by turning our Excel table into a data frame. However, this time we call the data frame source. Now in the next cell, K2, we copy that source data frame by using the copy method and we call the copy DF. We'll see why we are doing this in just a moment. In cell K3, we want to find out if John completed the course and we can do this exactly the same way as we learned it in the previous video by using a Boolean series for the row selection, along with the name of the column of interest. As the preview shows, this is false, but we know that it actually should be true. So to fix this, we…
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.