Convenient Methods to Rename Columns of Dataset with Pandas in Python

To display how easy it is to rename columns of a dataset for different cases using Python Pandas Library

Dr. Shouke Wei
6 min readNov 8, 2022

We usually change certain variables, rename, even add or completely replace variable names because the variable names from the original data files don’t adhere to the preferred naming conventions, including but not limited to the following reasons:

  • names are very long
  • names contains unwanted symbols, special characters or spaces
  • names are capitalized, but we need lower cased names, or
  • we need to add prefixes or suffixes, and whatever

Thus, we need to change the variable names as an initial step of data management or data analysis. In this post, it displays how to change the variable names, i.e. column names of datasets in the form of Pandas DataFrame.

This article is the Part II of Data Analysis Series, which includes the following parts. I suggest you read from the first part so that you can better understand the whole process.

--

--

Dr. Shouke Wei

Professor and Scientist in data analysis and modelling, machine learnig, and computer vision. Support my writing: https://medium.com/@shouke.wei/membership