From the course: Data Analysis with Python and Pandas

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Solution: Dropping data

Solution: Dropping data

- [Instructor] All right, the solution code is up on the right. Let's go ahead and dive into the notebook. Okay, so our first goal here was to drop the first row of our data, and we want this permanently removed from our transactions data frame. So this is going to be an in place operation. So let's go ahead and use the drop method on our transactions data frame. And we want to drop just the first row, so we'll specify index zero axis equals zero. That's our row axis, and we want to specify in place equals true. So let's go ahead and do this, and let's go ahead and return our data frame afterwards since this is in place, it won't return a data frame. And after doing that, we can see we've successfully dropped this first row. It's no longer in our transactions data frame. The next piece was to drop our date column, but not in place. So we want to specify transactions drop. And here you want to specify our date column. We want to specify axis equals one to get our column axis and…

Contents