Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

scale just one column pandas

In [90]: df = pd.DataFrame(np.random.randn(5, 3), index=list('abcde'), columns=list('xyz'))

In [91]: df
Out[91]:
          x         y         z
a -0.325882 -0.299432 -0.182373
b -0.833546 -0.472082  1.158938
c -0.328513 -0.664035  0.789414
d -0.031630 -1.040802 -1.553518
e  0.813328  0.076450  0.022122

In [92]: from sklearn.preprocessing import MinMaxScaler

In [93]: mms = MinMaxScaler()

In [94]: df[['x','z']] = mms.fit_transform(df[['x','z']])

In [95]: df
Out[95]:
          x         y         z
a  0.308259 -0.299432  0.505500
b  0.000000 -0.472082  1.000000
c  0.306662 -0.664035  0.863768
d  0.486932 -1.040802  0.000000
e  1.000000  0.076450  0.580891
Comment

PREVIOUS NEXT
Code Example
Python :: filter parent based on related child name values 
Python :: django Account has no customer 
Python :: image name validate using regex python 
Python :: matrix of matrices python grepper 
Python :: how to create a sub project in django 
Python :: captcha.image install in python 
Python :: write yaml file without deleting content 
Python :: tkinter centre a button on 1920x1080 
Python :: how to import discord in python rewrite vscode 
Python :: how to get a rectangular grid out of two given one-dimensional arrays 
Python :: how to import qpalette pyqt5 
Python :: python on read text execute command 
Python :: schedule a function python inside tkinter loop 
Python :: python tuples number Multiplication 
Python :: can you use the astro a50 with a phone 
Python :: creer des disques en python tkinter 
Python :: how to get the words inside a entry tkinter python 
Python :: add fully connected layers at encoder of autoencoder 
Python :: scrapy itemloader example 
Python :: Perform a left outer join of self and other. 
Python :: arrotondamento python 
Python :: access data frame element by loc 
Python :: count number of repeats in list python 
Python :: pandas save csv list as columns 
Python :: connect kaggle to colab 
Python :: I want only the span of finditer in re python 
Python :: 2checkout python 
Python :: how to get the number in the tenths place of a integer in python 
Python :: kivy on press call python function 
Python :: sklearn random forest feature importance 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =