Mapping Categorical to Numerical Data with pandas in Python Template
The following Mapping Categorical to Numerical Data with pandas in Python template shows how to deal with categorical variables in a dataset. The dataset contains an 'Attendance' feature whose categories are either 'Yes' or 'No'. The program maps the 'Yes' and 'No' categories to 1s and 0s using the pandas library. Download and unzip the .zip file in a new folder. Inside the folder you will find a .csv and a .ipynb file. The first one contains the database and the second one contains the Python code. Open the .ipynb file using Jupyter notebook. Some other related topics are Dummy Variables with pandas Python, Removing Missing Values with pandas Python, Removing Outliers with pandas Python.
You can now download the Python template for free.
This template is among the topics covered in detail in the 365 Data Science program.
Who is it for
This is an open-access Python template in .ipynb format that will be useful for anyone who wants to work as a Data Analyst, Data Scientist, Business Analyst, Statistician, Software Engineer, and anyone who works with Python.
How it can help you
More often than not, datasets include features that are not numerical but rather categorical - such are, for example, gender, occupation, country, etc. Unfortunately, algorithms need to be fed with numbers. This template can be used whenever we are faced with such a problem.