MachineLearning: How to use Column Transformer in scikit-learn, python ver. 2

Last Updated on June 7, 2022 by shibatau

I. Column Transformer

The data need to be represented in numerical form in order to work with Machine Learning. You may have used LabelEncoding and OneHotEncoding to convert categorical data to a numerical form but the OneHotEncoder categorical_features( ) has been deprecated now.

Let’s learn how to use a new library called Column Transfer to transform categorical data:

Use ColumnTransformer in SciKit instead of LabelEncoding and OneHotEncoding for data preprocessing in Machine Learning

II. Sample Scripts 1

You can see the scripts on Google Colaboratory:

https://colab.research.google.com/drive/11nXj_2bBbRd0jjSsJgt_Xg_2ZNoiyfbZ?usp=sharing

III. Sample Scripts 2

You can learn why and how to use Column Transformer from the post:

ColumnTransformer: Why And How To Use It

I have run the scripts showed above and got the columns transformed.

You can see the scripts here:

https://colab.research.google.com/drive/1uWN5709ke0LZHSoyuoi9-qCdoF2Uaw6m?usp=sharing

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.