Convenient Methods to Encode Categorical Variables in Python
Easy and flexible methods to encode string variables for further quantitative analysis
6 min readNov 12, 2022
In many cases, we need to transfer categorical or string variables into numbers in order to analyze the data quantitatively or develop a model. There are many different methods to do that. In this article, I will show you some easy but practical methods to encode columns with categorical data or strings into numerical values.
This article is the Part VII 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.
- Part I: How to Read Dataset from GitHub and Save it using Pandas
- Part II: Convenient Methods to Rename Columns of Dataset with Pandas in Python
- Part III: Different Methods to Access General Information of A Dataset with Python Pandas
- Part IV: Different Methods to Easily Detect Missing Values in Python
- Part V: Different Methods to Impute Missing Values of Datasets with Python Pandas
- Part VI: Different Methods to Quickly Detect Outliers of Datasets with Python Pandas
- Part VII: Different Methods to…