PYTHON PROGRAM TO DEMONSTARTE LABEL ENCODING..

Published: 01 January 1970
on channel: PythonEnthusiasts
9
1

#PYTHON PROGRAM TO DEMONSTARTE LABEL ENCODING
LABEL ENCODING : converting categorical data to numerical data

import numpy as np
import pandas as pd

from sklearn import preprocessing


Import dataset
df = pd.read_csv('C:\Vinuthna\python_enthu\Iris.csv')
print(df['species'].unique())

#Encode the Labels in Species Column

label_encoder = preprocessing.LabelEncoder()
df['species']= label_encoder.fit_transform(df['species'])

print("After Encoding")
print(df['species'].unique())

OUTPUT:
['setosa' 'versicolor' 'virginica']
After Encoding
[0 1 2]


On this page of the site you can watch the video online PYTHON PROGRAM TO DEMONSTARTE LABEL ENCODING.. with a duration of hours minute second in good quality, which was uploaded by the user PythonEnthusiasts 01 January 1970, share the link with friends and acquaintances, this video has already been watched 9 times on youtube and it was liked by 1 viewers. Enjoy your viewing!