From the course: Python Data Science Mistakes to Avoid

Unlock the full course today

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

Not updating your dataset

Not updating your dataset - Python Tutorial

From the course: Python Data Science Mistakes to Avoid

Start my 1-month free trial

Not updating your dataset

- [Narrator] Another mistake to avoid, when working with data, is not updating your dataset properly. For example, let's say that I have a variable named Grades, containing a pandas DataFrame, and the DataFrame consists of students' grades across five exams. I've displayed it here. Now, say that the student ID column, is not relevant for my task at hand. So, I want to drop that column from the dataset. Say, I call the pandas drop function on grades and passing the columns argument, a student ID like this. As you can see, when I ran this cell, I did indeed get a pandas DataFrame containing the data from the grades DataFrame, with the student ID column dropped. However, the grades DataFrame was not updated, which you will see when I run this cell here. As you can see, the grades DataFrame, still has a student ID column. So, I did not actually update it. To update it, I would reassign grades, to the DataFrame that is…

Contents