Predictive Hacks

How to apply a Sklearn scaler by rows in Pandas Dataframe

Let’s say that we want to apply the MinMaxScaler from the Sklearn in a pandas Data Frame by row and not by column which is the default.

import pandas as pd
from sklearn.preprocessing import MinMaxScaler
#for this post we will use MinMaxScaler

       A      B      C
0   10.0   13.0   11.0
1    0.3    0.5    0.1
2  141.0  110.0  107.0
     A         B         C
0  0.0  1.000000  0.333333
1  0.5  1.000000  0.000000
2  1.0  0.088235  0.000000

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore


Image Captioning with HuggingFace

Image captioning with AI is a fascinating application of artificial intelligence (AI) that involves generating textual descriptions for images automatically.


Intro to Chatbots with HuggingFace

In this tutorial, we will show you how to use the Transformers library from HuggingFace to build chatbot pipelines. Let’s