How to Rename Columns in Pandas DataFrame
Channel: Erik Marsja
Date: 2020-06-07

Here you will learn how to rename columns in Pandas dataframe. 

» Make sure you subscribe to the channel if you haven't: http://bit.ly/SUB2EM

Description:

In this tutorial, I will cover two of the methods that you can use when you need to rename the columns in your dataframe. 

First, before renaming the columns, I will give a brief introduction to the different ways to change the names of the columns.  After this is done, I will read example data (see link below) and then I will talk a bit about how to use the rename method. The video will continue by showing examples on how to rename 1) a single columns, 2) two columns, and 3) three columns. After that I will also cover how to use the columns method of the dataframe object and how you can use this for renaming all your columns in the dataframe. 


Finally, I will show you how to change the column names while reading data from a CSV file. Changing the column names this way can be done by using some of the arguments of the read_csv method. To fully follow this tutorial you need to have Python, Pandas, and Jupyter installed on your computer. Of course, if you prefer to work with Python code in another environment, Jupyter is not needed. 


Links related to renaming columns:
» Example data: https://bit.ly/example_csv
» Jupyter Notebook: https://bit.ly/ipynp_renaming
» Blog post: https://bit.ly/renaming_columns_post

If you need to learn more about importing data from CSV files with Pandas:

» Blog post: https://bit.ly/pandas_read_csv
» YouTube Video: https://youtu.be/piCU_gxSF7I

Social Media Accounts to Follow to Never Miss New Content:

» Telegram channel: https://t.me/MarsjaSe
» Twitter:                   https://twitter.com/MarsjaSe
» Mastadon:             https://mastodon.social/@ttacks
» Github:                   https://github.com/marsja/
» LinkedIn:                https://www.linkedin.com/in/erik-marsja-005a0760/

3:21 Importing Pandas
3:40 Reading a CSV File
4:51 The Rename method explained
5:42 Renaming a single column example
6:28 Renaming two columns example
7:01 Renaming three columns example
7:41 Changing name with the columns method
10:13 Rename the columns while reading data
13:02 Conclusion