# Normalize A Column In pandas

## Preliminaries

``````
/* Import required modules */
import pandas as pd
from sklearn import preprocessing

/* Set charts to view inline */
%matplotlib inline``````

## Create Unnormalized Data

``````
/* Create an example dataframe with a column of unnormalized data */
data = {'score': [234,24,14,27,-74,46,73,-18,59,160]}

df = pd.DataFrame(data)
df``````
score
0 234
1 24
2 14
3 27
4 -74
5 46
6 73
7 -18
8 59
9 160
``````
/* View the unnormalized data */
df['score'].plot(kind='bar')``````
``````<matplotlib.axes._subplots.AxesSubplot at 0x11b9c88d0>
``````

## Normalize The Column

``````/* Create x, where x the 'scores' column's values as floats */
x = df[['score']].values.astype(float)

/* Create a minimum and maximum processor object */
min_max_scaler = preprocessing.MinMaxScaler()

/* Create an object to transform the data to fit minmax processor */
x_scaled = min_max_scaler.fit_transform(x)

/* Run the normalizer on the dataframe */
df_normalized = pd.DataFrame(x_scaled)``````
``````/* View the dataframe */
df_normalized``````
0
0 1.000000
1 0.318182
2 0.285714
3 0.327922
4 0.000000
5 0.389610
6 0.477273
7 0.181818
8 0.431818
9 0.759740
``````
/* Plot the dataframe */
df_normalized.plot(kind='bar')``````
``````<matplotlib.axes._subplots.AxesSubplot at 0x11ba31c50>
``````

# Special 95% discount

## Two Machine Learning Fields

There are two sides to machine learning:

• Practical Machine Learning:This is about querying databases, cleaning data, writing scripts to transform data and gluing algorithm and libraries together and writing custom code to squeeze reliable answers from data to satisfy difficult and ill defined questions. It’s the mess of reality.
• Theoretical Machine Learning: This is about math and abstraction and idealized scenarios and limits and beauty and informing what is possible. It is a whole lot neater and cleaner and removed from the mess of reality.

Data Science Resources: Data Science Recipes and Applied Machine Learning Recipes

Introduction to Applied Machine Learning & Data Science for Beginners, Business Analysts, Students, Researchers and Freelancers with Python & R Codes @ Western Australian Center for Applied Machine Learning & Data Science (WACAMLDS) !!!

Latest end-to-end Learn by Coding Recipes in Project-Based Learning:

Applied Statistics with R for Beginners and Business Professionals

Data Science and Machine Learning Projects in Python: Tabular Data Analytics

Data Science and Machine Learning Projects in R: Tabular Data Analytics

Python Machine Learning & Data Science Recipes: Learn by Coding

R Machine Learning & Data Science Recipes: Learn by Coding

Comparing Different Machine Learning Algorithms in Python for Classification (FREE)

`Disclaimer: The information and code presented within this recipe/tutorial is only for educational and coaching purposes for beginners and developers. Anyone can practice and apply the recipe/tutorial presented here, but the reader is taking full responsibility for his/her actions. The author (content curator) of this recipe (code / program) has made every effort to ensure the accuracy of the information was correct at time of publication. The author (content curator) does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause. The information presented here could also be found in public knowledge domains.  `