Lab2: Univariate Analysis

Course: INF-604: Data Analysis
Lecturer: Sothea HAS, PhD


Objective: In this lab, you will explore the columns of a dataset according to their data types. Your task is to employ various techniques, including statistical values and graphical representations, to understand the dataset before conducting deeper analysis.


1. Food Delivery Dataset

This dataset contains food delivery times based on various influencing factors such as distance, weather, traffic conditions, and time of day. It offers a practical and engaging challenge for machine learning practitioners, especially those interested in logistics and operations research. Read and load the data from kaggle: Food Delivery Dataset.

import kagglehub

# Download latest version
path = kagglehub.dataset_download("denkuznetz/food-delivery-time-prediction")

# Import data
import pandas as pd
data = pd.read_csv(path + "/Food_Delivery_Times.csv")
data.head()
Order_ID Distance_km Weather Traffic_Level Time_of_Day Vehicle_Type Preparation_Time_min Courier_Experience_yrs Delivery_Time_min
0 522 7.93 Windy Low Afternoon Scooter 12 1.0 43
1 738 16.42 Clear Medium Evening Bike 20 2.0 84
2 741 9.52 Foggy Low Night Scooter 28 1.0 59
3 661 7.44 Rainy Medium Afternoon Scooter 5 1.0 37
4 412 19.03 Clear Low Morning Bike 16 5.0 68

A. What’s the dimension of the data? Which variables are considered quantitative and which are qualitative?

Answer:

  • Are there any rows with missing values?

  • Are there any duplicated data?

  • Handling missing values is more complicated than you may expect. Here, we can simply drop those rows.

B. Qualitative variables:

  • Create statistical summary of qualitative columns.

  • Create graphical representation of these qualitative columns to understand them better.

  • Explain each column based on the stastical values and graphs.

C. Quantitative variables:

  • Create statistical summary of quantiative columns.

  • Create graphical representation of these quantitative columns to understand them better.

  • Explain each column based on the stastical values and graphs.

  • Are there any columns with outliers?

2. Cardiovascular Disease dataset

This dataset consists of 70 000 records of patients data, 11 features and a column of the presence or absence of cardiovascular disease. The data can be downloaded from kaggle using the following link: https://www.kaggle.com/datasets/sulianova/cardiovascular-disease-dataset.

import kagglehub

# Download latest version
path = kagglehub.dataset_download("sulianova/cardiovascular-disease-dataset")

data = pd.read_csv(path + "/cardio_train.csv", sep=";")
data.head()
id age gender height weight ap_hi ap_lo cholesterol gluc smoke alco active cardio
0 0 18393 2 168 62.0 110 80 1 1 0 0 1 0
1 1 20228 1 156 85.0 140 90 3 1 0 0 1 1
2 2 18857 1 165 64.0 130 70 3 1 0 0 0 1
3 3 17623 2 169 82.0 150 100 1 1 0 0 1 1
4 4 17474 1 156 56.0 100 60 1 1 0 0 0 0

Task: Analyze each column of the provided data by answering the questions listed in the previous section.

Further Reading