Data Science Course: EDA & Data Cleaning
Data Science Course: EDA & Data Cleaning
Objectives
1. Data mining process
2. Data source
3. Exploratory Data Analysis - EDA
4. Data Cleaning Techniques
5. Practise
1
11/19/2025
Reminding
Reference: Altaf, Saud & Asad, Rimsha & Ahmad, Shafiq & Ahmed [Link]. PhD, Iftikhar &
Abdollahian, Mali & Zaindin, Mazen. (2023). A Hybrid Framework of Deep Learning
Techniques to Predict Online Performance of Learners during COVID-19 Pandemic.
Sustainability. 15. 11731. 10.3390/su151511731.
2
11/19/2025
1. Data Source
Types of data
• Structured data: organized in rows and columns in a table, easy to
store and query using SQL, Excel, etc.
• Semi-structured data: has a flexible structure, not a rigid schema.
For example, email, XML, JSON.
• Unstructured data: no clear structure, difficult to analyze directly.
Examples: free text, images, videos, social media posts
3
11/19/2025
4
11/19/2025
Internal data
• Data files from the company:
• Most of them come from internal operations.
• Usually in the form of spreadsheets, texts.
• Coming from the database when operating the software
• Relational databases: Oracle, MS SQL Server, MySQL,…
• NoSQL: document, key-value, wide-column, and graph (MongoDB,
Cassandra, …)
• NewSQL: CockroachDB, NuoDB, VoltDB
Comparison sample: [Link] 9
Public data
• Open Data Portals: [Link]
• UCI Machine Learning Repository: [Link]
• Google Dataset Search: [Link]
• Other Resources:
• GitHub
• Kaggle
• …
10
10
5
11/19/2025
11
Big data ?V 12
12
6
11/19/2025
13
13
2. Exploratory Data
Analysis - EDA
14
14
7
11/19/2025
Introduction
• EDA – Exploratory Data Analysis is the process of describing data
using statistical and visualization techniques that focus on
important aspects of the data for further analysis.
• This includes examining the dataset from multiple angles,
describing and summarizing it without making any other
assumptions about its contents.
• EDA is an important step that needs to be taken before diving into
statistical modeling or machine learning.
15
15
EDA aims
• This EDA step gives us a first look at the data.
• It is necessary to have a certain sense of what you have in your hands before having a strategy to build a
model.
• EDA helps you visualize the complexity of the problem and map out the first steps to take.
• Data discovery doesn't stop at the first time before building a feature, but it also needs to be
done throughout the system development process.
• Once you've built the features, you'll also need to redo the EDA again to see if the processed data is really
clean.
• In addition, after building and analyzing the model, we also often need to return to EDA to continue to
discover what is hidden in the problem data.
• The deeper you understand the data; the sooner you'll be able to interpret the behavior of
the model and make appropriate changes.
16
16
8
11/19/2025
• Data size
• What each data field means
• Data types for each field
•"Pclass": seat class. 1 = Upper class, 2 = Middle class, 3 = Lower class. Thus, the
• Probability distribution of each field "Pclass" information field can be considered both a category characteristic and a
numerical feature because it is orderly. This feature is likely to affect the survivability
• Correlation between data fields of passengers because more luxury classes may have better safety measures (or
vice versa, more subjective).
•"Sex": Passenger Gender.
•"Age": the age of the passenger. If the age is less than 1, it is in the form of an odd
number (0.42), if the age is an estimate, it is in the form xx.5. Obviously, this will also
be a potential feature to predict the outcome of the problem because children and the
elderly are in the higher risk group.
•"Sibsp": the number of siblings or spouses on board the ship.
•"Parch": Number of parents/children on board.
•"Ticket": Ticket number.
•"Fare": Fares.
Examples for descriptive statistics •"Cabin": Cabin code.
•"Embarked": Where to board, C = Cherbourg, Q = Queenstown, S = Southampton.
Library Referenceydata-profiling
17
17
3. Data Cleaning
Techniques
18
18
9
11/19/2025
Introduction
• Data cleaning is the process of correcting or removing inaccurate,
incorrect format, duplicate, irrelevant, incomplete, or problematic
data in a database.
• Effective data cleaning will ensure that the data is consistent and
free of any errors that can cause problems during later use or
analysis.
19
19
20
20
10
11/19/2025
21
• Cons: Can lose a lot of important information and reduce statistical power if too
many rows are deleted.
22
22
11
11/19/2025
• Mean: Replace the missing value with the average of the remaining values in the column (consistent with continuous data and
standard distribution).
• Median: Substitutes with the median of the remaining values in the column, which is especially effective when the data has outlier
values (consistent with continuous data).
• Most Common Value (Mode): Replace with the most occurring value, usually used for categorical variables.
• Assign a fixed value: Replace the missing value with a predefined value (for example, or another value).
• Regression: Use a regression model to predict and fill in missing values based on other columns.
• KNN Imputation: TInsert the nearest data points (K-Neighbors) to the missing points and use their values to fill in the blanks.
• Multiple Imputation: Create multiple datasets with values, analyze them on each dataset, and then combine the results to reduce
bias.
23
23
24
24
12
11/19/2025
• Understanding why data is missing (random, systematic) will help choose a more appropriate method.
• If the data missing rate is low, it makes sense to delete the row or replace it with a statistical value. If the
deficiency rate is high, more complex methods should be considered.
• Choose the method based on the requirements for accuracy, project objectives and available knowledge and
resources.
• Trial:
• No method is perfect, it is necessary to test different methods to find the best solution for your dataset.
25
26
13
11/19/2025
• Example:
• If you're working with spreadsheets or tables, you can use the software's built-in features,
such as Excel's Remove Duplicates or Google Sheet's Unique, to highlight or filter
duplicate rows.
• If you're working with a programming language, such as Python or R, you can use libraries
or packages, such as pandas or dplyr, to detect and remove duplicate rows in your data
frame.
27
27
• Deleting duplicate rows can reduce the size and complexity of the dataset, but it can also cause bias. Retaining only one
instance of duplicate rows requires you to choose which instances to retain and remove.
• Aggregating or averaging duplicate rows can reduce noise or outliers in the data but may not properly reflect the true
distribution or variation.
• Modifying or merging duplicate rows can improve or enrich data but can also cause errors or inconsistencies.
• Therefore, when making decisions about how to handle duplicate data, you should carefully consider all
of these options and their potential implications.
28
28
14
11/19/2025
Data Transformation
29
29
Data Transformation
• It is the process of processing raw data, including cleaning, restructuring, and adding information so
that it becomes accurate, consistent, and suitable for analysis, reporting, or other purposes.
• In data analytics, data transformation plays an extremely important role for the following reasons:
• Improved data quality: Data after conversion eliminates errors, outliers, and inconsistencies, making the data cleaner
and more accurate for further analysis.
• Data Normalization: Data transformation creates uniformity in format, units of measurement, and data structure,
making it easy to compare and combine data from a variety of sources.
• Increased analysis efficiency: New variables created through transformation techniques provide additional
perspectives, helping to uncover hidden relationships, trends, or data patterns that were not previously exploited.
• Optimize system performance: Standardized and properly grouped data will minimize the processing time and storage
space required, especially when deployed on platforms such as cloud servers or hosting services that P.A Vietnam
provides.
30
30
15
11/19/2025
31
31
𝑋
1.4. Unit Vector (Vector) Normalization: scales a data vector to have a magnitude of 1: 𝑋 ′ =
𝑋
32
32
16
11/19/2025
33
33
34
34
17
11/19/2025
35
35
Outliers
36
36
18
11/19/2025
Introduction
• In numerical form, the outlier data can be an unrealistic value
such as a negative age number, or a value that is far from the rest
of the values in that field.
• In the form of a categorical, the outlier data can be an unrealistic
value as a category that is outside the possibilities of a landmark
that is not on the map.
• Values with an extremely low frequency of occurrence in a data
column are also likely to be an outlier.
37
37
38
19
11/19/2025
𝑥−𝜇
• For a data point x, its z score is calculated by:
𝜎
• Points with z scores outside of the [−3,3] paragraph can be considered as outliers. A slight mathematical variation, this is
equivalent to the fact that points outside the [𝜇 − 3𝜎, 𝜇 + 3𝜎] segment are considered outliers..
39
39
40
40
20
11/19/2025
41
42
21
11/19/2025
Summary
• DIKW Model
• Data mining methodology
• Data types, data sources, and data approaches.
• Exploratory Data Analysis (EDA)
• Some data cleaning techniques
43
43
PRACTISE
Using Orange Data Mining
[Link]
44
44
22
11/19/2025
Requirements
• Purpose: Practice for data preprocessing using Orange tools
• Estimated Time: 90 minutes
• Form: team-work
• Workflow:
1. Understanding information (meta-data) about datasets horse-colic.
2. Practice with the Orange widgets File, FileInfo, Table, Features Statistics, Pivot,
Scatter Plot, …
3. Find out at least 3 assertions (information) in this dataset.
4. Conducting explanations.
45
45
Descriptive Statistics
• What information is
found from this step?
• Making an arguments.
• Form:
• Widget: ?
• Gained information: ?
• Explanation: ?
46
46
23
11/19/2025
Feature Engineering
• Observe and make
comments.
• Do some formulas to
create new variables.
• Form:
• New variable: ?
• Formula: ?
• Explanation: ?
47
47
48
48
24
11/19/2025
49
49
Data grouping
50
50
25
11/19/2025
51
Data transformation
• Perform complete preprocessing of the dataset.
52
26
11/19/2025
Advanced Exercises
• Purpose: Practice for data
preprocessing using Orange tools
• Estimated Time: 180 minutes
• Form: Teamwork
• Workflow:
1. Find a dataset that is relevant to the student's major. Learn meta-data.
2. Consider dataset scenarios→Choose ways to clean your data. Arguments for
this.
3. Present the comments as a word file and submit them to the LMS system.
53
53
References
1. Andrew Park, Data Science for Beginners,ISBN 978-1914167508,
Independently Published, 11 November 2020
2. [Link]
3. [Link]
4. [Link]
5. [Link]
6. [Link]
7. …
54
54
27
11/19/2025
Vietnam
[Link]
Thank You /
55
55
28