In this project, we analyze the clothing size, plot a graph between sizes and count and also plot heatmap using Python in Machine Learning.
Step:- 1
First, we upload the necessary libraries then we upload the dataset
import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt
CLL = pd.read_csv("Clothe.csv")
CLL
CLL.isna().sum()
CLL.describe()
CLL.info()
CLL['age'] = CLL['age'].fillna(CLL['age'].median()) CLL['height'] = CLL['height'].fillna(CLL['height'].median(
CLL.isna().sum()
Step:- 2
Now Plotting histogram between Count and Predictor
fig, axes = plt.subplots(1,3,figsize=(20,5))
fig.suptitle('Predictor')
# weight
sns.histplot(CLL['weight'], ax = axes[0])
axes[0].set_title('weight')
# age
sns.histplot(CLL['age'], ax = axes[1])
axes[1].set_title('age')
# height
sns.histplot(CLL['height'], ax = axes[2])
axes[2].set_title('height')
Now Plotting histogram between Weight and Predictor
fig, axes = plt.subplots(1,3,figsize=(20,5))
fig.suptitle('Predictor')
# weight
sns.boxplot(x = 'size',y = 'weight', data = CLL, ax = axes[0])
axes[0].set_title('weight')
# age
sns.boxplot(x = 'size',y = 'age', data = CLL, ax = axes[1])
axes[1].set_title('age')
# height
sns.boxplot(x = 'size',y = 'height', data = CLL, ax = axes[2])
axes[2].set_title('height')
Step:- 3
CLL['size'].value_counts()
Here we see the most numbers of people use "M" Size and fewer numbers of people use "XXL"
sns.countplot(x = 'size', data = CLL)
Plotting graph between count and size
CLL['size'] = CLL['size'].map({"XXS": 1,
"S": 2,
"M" : 3,
"L" : 4,
"XL" : 5,
"XXL" : 6,
"XXXL" : 7})
CLL.head()
Mapping clothes size from strings to numeric
sns.heatmap(CLL.corr(), annot=True)
Now we Plot a heat map
Submitted by Subhojit Jalal (Subhojit1234)
Download packets of source code on Coders Packet
Comments