Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How to scale a pandas dataframe

import seaborn as sns
import pandas as pd
import numpy as np
 
data = sns.load_dataset('iris')
print('Original Dataset')
data.head()
 
# Min-Max Normalization
df = data.drop('species', axis=1)
df_norm = (df-df.min())/(df.max()-df.min())
df_norm = pd.concat((df_norm, data.species), 1)
 
print("Scaled Dataset Using Pandas")
df_norm.head()
Comment

PREVIOUS NEXT
Code Example
Python :: how to disconnect wifi using python 
Python :: python substitute multiple letters 
Python :: python how to keep turtle window open 
Python :: Change my python working directory 
Python :: float to string python 
Python :: delete one pymongo 
Python :: append in a for loop python 
Python :: pandas remove outliers for multiple columns 
Python :: python convert to percentage 
Python :: login_required on class django 
Python :: pandas dataframe unique multiple columns 
Python :: matplotlib measure the width of text 
Python :: joining pandas dataframes 
Python :: pandas replace values based on condition 
Python :: generate a random letter using python 
Python :: how to rename rengeindex pandas 
Python :: batchnormalization keras 
Python :: how to convert utf-16 file to utf-8 in python 
Python :: hasattr in python 
Python :: apply same shuffle to two arrays numpy 
Python :: pandas series to tuple list 
Python :: python regular expression remove numbers 
Python :: python function returns function 
Python :: text to audio in python 
Python :: python key list 
Python :: loop through list of dictionaries python 
Python :: how to remove tkinter icon 
Python :: how to print all elements of a dictionary in python 
Python :: python convert date to timestamp 
Python :: move items from one list to another python 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =