Aerofit Case Study Analysis - Ipynb - Colaboratory
Aerofit Case Study Analysis - Ipynb - Colaboratory
ipynb - Colaboratory
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
url = "https://d2beiqkhq929f0.cloudfront.net/public_assets/assets/000/001/125/original/aerofit_treadmill.csv?1639992749"
data = pd.read_csv(url)
data.shape
(180, 9)
data.head()
data['Gender'].dtypes
dtype('O')
data.dtypes
Product object
Age int64
Gender object
Education int64
MaritalStatus object
Usage int64
Fitness int64
Income int64
Miles int64
dtype: object
data.describe()
Gender_counts = data['Gender'].value_counts()
print(Gender_counts)
Male 104
Female 76
Name: Gender, dtype: int64
https://colab.research.google.com/drive/1HDCIdYeIZJKlt_2pHrisj8nmauAa53wp?authuser=0#scrollTo=qtC3d7NPoKDw&printMode=true 1/6
10/25/23, 6:00 PM Aerofit Case Study analysis.ipynb - Colaboratory
MaritalStatus_counts = data['MaritalStatus'].value_counts()
print(MaritalStatus_counts)
Partnered 107
Single 73
Name: MaritalStatus, dtype: int64
#plt.figure(figsize=(12, 5))
sns.distplot(data['Age'], bins=20, kde=False, color='skyblue')
plt.title('Age Distribution')
plt.xlabel('Age')
plt.ylabel('Frequency')
plt.show()
<ipython-input-29-92f34d3d87f0>:2: UserWarning:
Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `histplot` (an axes-level function for histograms).
For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751
#plt.figure(figsize=(12, 5))
sns.distplot(data['Income'], bins=20, kde=False, color='salmon')
plt.title('Income Distribution')
plt.xlabel('Income ($)')
plt.ylabel('Frequency')
plt.show()
https://colab.research.google.com/drive/1HDCIdYeIZJKlt_2pHrisj8nmauAa53wp?authuser=0#scrollTo=qtC3d7NPoKDw&printMode=true 2/6
10/25/23, 6:00 PM Aerofit Case Study analysis.ipynb - Colaboratory
<ipython-input-28-8cd2e39d1613>:2: UserWarning:
Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `histplot` (an axes-level function for histograms).
For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751
# Correlation heatmap
correlation_matrix = data.corr()
sns.heatmap(correlation_matrix, annot=True, cmap='coolwarm', linewidths=0.5)
plt.title('Correlation Heatmap')
plt.show()
https://colab.research.google.com/drive/1HDCIdYeIZJKlt_2pHrisj8nmauAa53wp?authuser=0#scrollTo=qtC3d7NPoKDw&printMode=true 3/6
10/25/23, 6:00 PM Aerofit Case Study analysis.ipynb - Colaboratory
<ipython-input-32-43edec4bd922>:2: FutureWarning: The default value of numeric_only in DataFrame.corr is deprecated. In a future version
correlation_matrix = data.corr()
https://colab.research.google.com/drive/1HDCIdYeIZJKlt_2pHrisj8nmauAa53wp?authuser=0#scrollTo=qtC3d7NPoKDw&printMode=true 4/6
10/25/23, 6:00 PM Aerofit Case Study analysis.ipynb - Colaboratory
#Missing Values
missing_values = data.isnull().sum()
print(missing_values)
Product 0
Age 0
Gender 0
Education 0
MaritalStatus 0
Usage 0
Fitness 0
Income 0
Miles 0
dtype: int64
#Outlier Values
# Outlier detection using boxplots
plt.figure(figsize=(12, 5))
# Boxplot for 'Age'
plt.subplot(131)
sns.boxplot(x=data['Age'], color='skyblue')
plt.title('Age Boxplot')
plt.figure(figsize=(12, 5))
# Boxplot for 'Income'
plt.subplot(132)
sns.boxplot(x=data['Income'], color='salmon')
plt.title('Income Boxplot')
https://colab.research.google.com/drive/1HDCIdYeIZJKlt_2pHrisj8nmauAa53wp?authuser=0#scrollTo=qtC3d7NPoKDw&printMode=true 5/6
10/25/23, 6:00 PM Aerofit Case Study analysis.ipynb - Colaboratory
#Outlier Values
# Outlier detection using boxplots
plt.figure(figsize=(12, 5))
plt.tight_layout()
plt.show()
https://colab.research.google.com/drive/1HDCIdYeIZJKlt_2pHrisj8nmauAa53wp?authuser=0#scrollTo=qtC3d7NPoKDw&printMode=true 6/6