DEV Community

loading...
Cover image for Machine Learning journey : Day 4 (Python | Descriptive Statistics | Case Study)

Machine Learning journey : Day 4 (Python | Descriptive Statistics | Case Study)

iamvigneshc profile image Vignesh C Updated on ・2 min read

Subscribe to my Youtube channel

Cardio Good Fitness Case Study

The market research team at AdRight is assigned the task to identify the profile of the typical customer for each treadmill product offered by CardioGood Fitness. The market research team decides to investigate whether there are differences across the product lines with respect to customer characteristics. The team decides to collect data on individuals who purchased a treadmill at a CardioGoodFitness retail store during the prior three months. The data are stored in the CardioGoodFitness.csv file.

The team identifies the following customer variables to study:

  • product purchased, TM195, TM498, or TM798;
  • gender;
  • age, in years;
  • education, in years;
  • relationship status, single or partnered;
  • annual household income ;
  • average number of times the customer plans to use the treadmill each week;
  • average number of miles the customer expects to walk/run each week;
  • self-rated fitness on an 1-to-5 scale, where 1 is poor shape and 5 is excellent shape.

Perform descriptive analytics to create a customer profile for each CardioGood Fitness treadmill product line.

# Load the necessary packages

import numpy as np
import pandas as pd

# Load the Cardio Dataset

mydata = pd.read_csv('CardioGoodFitness-1.csv')

mydata.head()
Enter fullscreen mode Exit fullscreen mode

Head:

Alt Text

Tail:

Alt Text

Describe:

mydata.describe(include="all")
Enter fullscreen mode Exit fullscreen mode

Alt Text

Info:

Alt Text

Histogram:

import matplotlib.pyplot as plt
%matplotlib inline

mydata.hist(figsize=(20,30))
Enter fullscreen mode Exit fullscreen mode

Alt Text
Alt Text
Alt Text

Boxplot:

import seaborn as sns

sns.boxplot(x="Gender", y="Age", data=mydata)
Enter fullscreen mode Exit fullscreen mode

Alt Text

Pair Plot

Alt Text
Alt Text

Crosstab:

Alt Text

Countplot:

Alt Text

Pivot table:

Alt Text

Correlation with heat map:

Alt Text


Other useful links:

https://numpy.org/
https://pandas.pydata.org/
https://seaborn.pydata.org/
https://matplotlib.org/

Discussion (0)

pic
Editor guide