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.

Rename and delete columns

Rename and delete columns - Python Tutorial

From the course: Python for Data Visualization

Rename and delete columns

- [Instructor] When you have a data set, it's often the case where you want to change your column names to make them more legible, more understandable, or more easy to program with, or sometimes you want to remove unnecessary columns. An advantage of removing unnecessary columns is it can free up RAM on your computer and it's also a good data science practice. There are two popular ways to rename data frame columns. The first is dictionary substitution, which is very useful if you only want to rename a few of your columns. There's also a list replacement, which requires a full list of names. And in my experience, this is more error prone. The data set we're going to work with is the car loan data set, and we'll look at the first five rows using the head method. And one reason why I want to rename a column, in this case the principle paid column, is if I try to use the dot notation where the data frame and a dot and the…

Contents