If you skip exploring your data first, you will build a machine learning model that fails silently, costs your company money, and makes terrible predictions it should have never made. That is the real-world consequence of ignoring exploratory data analysis: you waste time and resources on a model that is fundamentally broken from the start. For the MLS-C01 exam, this topic is the foundation of everything else – you cannot pass if you do not know how to look at data and understand what it is telling you.
Jump to a section
A simple way to picture Exploratory Data Analysis and Visualization
Your kitchen shelf, the one you shove random jars, spices, and tins into.
You need to make dinner, but you have no idea what you actually own. You start by pulling everything out onto the counter. You check the expiry date on every can of beans, sniff the suspicious jar of pickles, and notice the bag of flour has a tear with a little trail of white powder. One chocolate bar has a weird white bloom on it – is that mould or just fat rising to the surface? You line up all the spices in alphabetical order and notice you have three jars of cinnamon, one of which is just a dusty fossil from 2019. That sticky patch under the jar of honey tells you there was a slow leak you never noticed. You lay it all out, look at the patterns – two open bags of rice, a single lonely anchovy tin – and you now understand the state of your pantry. That is exploratory data analysis and visualisation. You do not yet know what you are cooking, but you now know what ingredients are spoiled, what you have too much of, and what mysterious objects are hiding in the back. Only then can you decide whether to make a stir-fry or throw it all away and order pizza.
The real goal is not to clean (that is later). The goal is to see the whole picture clearly enough that you can make a smart decision about what to do next. In machine learning, that seeing – that visual sniffing, sorting, and spotting – is what explorator y data analysis is all about.
Exploratory data analysis – often shortened to EDA – is the process of looking at raw data before you build any machine learning model. Think of it as meeting your date before agreeing to marry them. You need to know what you are working with. EDA has three big goals: find patterns, spot anomalies, and understand relationships between different pieces of data.
Let us break down the jargon. Data is just information – numbers, text, dates, images, anything you can collect. A dataset is a collection of that data, usually organised into rows and columns like an Excel spreadsheet. Each column is called a feature (sometimes a variable). Each row is a single observation or data point. For example, if you have a dataset of houses, the features might be "number of bedrooms", "square footage", and "price". Each row is one specific house with its specific values for those features.
When you start EDA, the first thing you do is check the shape of your data. How many rows and columns? Are there missing values – cells that are empty because the data was not recorded? Missing data is common and can break your model if you ignore it. You also look for duplicates – rows that are exactly the same as another row, which can accidentally make the model think certain patterns are more common than they really are.
Next, you examine the data types. Is a column full of numbers (integers or floats), text (strings), dates, or categories (like "red", "blue", "green")? The machine learning algorithm needs to know this because it cannot work with text directly. You will often need to convert categories into numbers using techniques like one-hot encoding, where each unique category gets its own column with a 1 or 0.
After that, you look at distributions. A distribution shows how often each value appears. For example, if you are looking at ages in a dataset, a distribution chart will show you if most people are in their 30s or if the ages are spread out evenly. This matters because a skewed distribution – where values cluster at one end – can mislead your model. A histogram is the common chart for this. It divides the range of values into bins (like 0-10, 10-20, 20-30) and counts how many data points fall into each bin.
Now, anomalies. These are data points that do not fit the normal pattern. A house that costs one dollar is likely an anomaly (maybe a typo). An age of 200 years is impossible. Anomalies can also be subtle – a sudden spike in website traffic at 3am might be a bot attack, or it might be a data collection error. Spotting these early saves you from training a model on nonsense.
Relationships between features are where the real value lies. You want to know: if the number of bedrooms increases, does the price usually increase too? That is called a correlation. If two features move in the same direction (both go up together), they are positively correlated. If one goes up while the other goes down, they are negatively correlated. A scatter plot is the classic visualisation for this – you put one feature on the x-axis (horizontal) and another on the y-axis (vertical), and each data point is a dot on the chart. If the dots form a rough line, there is a correlation. If they are scattered like confetti, there is no strong relationship.
You also check for multicollinearity – when two features are so strongly correlated that they essentially tell you the same thing. For example, "total square footage" and "number of rooms" might be highly correlated because bigger houses usually have more rooms. Some machine learning models get confused by this, so you might need to remove one of the two features.
Visualisation is the tool that makes EDA practical. You use charts and graphs to see patterns that are invisible in a table of numbers. Common types include:
Histograms for showing the distribution of a single numeric feature.
Box plots for spotting outliers and seeing the range where most values fall. A box plot shows the median (the middle value), the quartiles (the 25th and 75th percentiles), and any outliers as dots beyond the whiskers.
Scatter plots for looking at relationships between two numeric features.
Bar charts for comparing categories (like which product sells the most).
Heatmaps for showing correlations between many features at once. A heatmap uses colour to represent the correlation strength – dark red might mean strong positive, dark blue might mean strong negative.
Why does EDA exist? Before machine learning became mainstream, data analysts would manually look at spreadsheets and draw graphs by hand (or with early software like Excel). The process was slow and limited to small datasets. Today, with massive datasets containing millions of rows, you need automated tools and programming libraries like Python's pandas, matplotlib, and seaborn to explore data efficiently. EDA replaces guesswork with evidence. Instead of assuming what the data looks like, you prove it to yourself visually and numerically.
What does EDA replace? It replaces the dangerous practice of feeding data directly into a model without understanding it. That is called "garbage in, garbage out" – if you put bad data in, you will get bad predictions out. EDA is the quality check that prevents garbage from entering your machine learning pipeline.
Load the dataset
Read the raw data from its source (CSV file, database, API) into a tool like Python with pandas or a spreadsheet. Check the number of rows and columns to understand the size of the data you are working with.
Inspect for missing values and duplicates
Count how many values are missing in each column and decide how to handle them (drop rows, impute with mean/median/mode, or flag them). Identify and remove duplicate rows that could distort analysis.
Examine data types and distributions
Check whether each column is numeric, text, date, or categorical. Convert text to categories and dates to numeric features. Plot histograms for numeric columns to see how values are spread and whether the distribution is skewed.
Detect outliers and anomalies
Use box plots and the IQR method to find values that are far from the typical range. Investigate anomalies to determine if they are errors (typos, sensor failures) or legitimate rare events (like a holiday spike).
Analyse relationships between features
Create scatter plots for pairs of numeric features and calculate correlation coefficients. Build a heatmap to visualise correlations across all features. Identify highly correlated features that may cause multicollinearity.
Encode categorical data and handle imbalance
Convert categorical columns into numeric format using one-hot encoding or label encoding. Check the target variable (the thing you want to predict) for class imbalance and plan resampling if needed.
Summarise findings and document decisions
Write down key insights: which features matter, which anomalies were removed, how missing values were handled. This documentation ensures reproducibility and provides context for the modelling step that follows.
Imagine you work as a data scientist at an online clothing retailer called StyleShip. The company wants to build a machine learning model that predicts whether a customer will return a purchased item within 30 days. This is a binary classification problem – the outcome is either "return" or "keep". The business goal is to reduce return rates by identifying high-risk purchases early.
You are given a dataset with 500,000 rows, each representing a single purchase. The features include: customer age, purchase amount, item category (dress, shoes, accessories), day of the week, whether the customer used a discount code, the customer's previous return rate, and the item colour. Your first move is to open the dataset and start EDA.
You begin by checking the shape – 500,000 rows and 15 columns. Good, you have plenty of data. Next, you check for missing values. You find that 12% of rows have a missing value for "customer age". That is a significant chunk. You need to decide whether to drop those rows, fill them with an average age, or use a more sophisticated imputation method (guessing the missing value from other features). You also find 200 duplicate rows – identical purchases recorded twice. You delete those.
Now you look at data types. The "item category" is text – "dress", "shoes", "accessories". You convert it to numbers using one-hot encoding, creating three new columns: is_dress, is_shoes, is_accessories, each containing 0 or 1. The "purchase date" is stored as a date string. You extract the day of the week from it and make that a separate numeric feature (Monday=0, Sunday=6).
You then generate visualisations. You make a histogram of purchase amounts. It shows a right-skewed distribution – most purchases are between £20 and £80, but there is a long tail of very expensive items up to £2,000. Those expensive items are rare but could be important for returns. You make a box plot of customer age. It shows the median age is 34, with most customers between 22 and 52. But there are a few ages listed as 0 and one as 150 – clearly data entry errors. You remove those anomalous rows.
Next, you explore relationships. You make a scatter plot of purchase amount versus previous return rate. You see a faint positive correlation – customers who previously returned more items tend to purchase slightly more expensive items. That is interesting but weak. You then create a heatmap of correlations between all numeric features. You notice a strong correlation between "purchase amount" and "used discount code" – customers who use discount codes tend to spend less. That makes sense.
You also look for patterns by category. You group the data by item category and compute the return rate for each. You find that shoes are returned 25% of the time, dresses 18%, and accessories only 8%. That is a crucial insight – the model should give extra weight to shoe purchases. You create a bar chart to present this to your team because visuals are easier to understand than tables.
Finally, you identify a subtle anomaly. The dataset shows that purchases made on Sundays have a return rate of 35% compared to 15% on other days. At first you think it is a pattern, but then you dig deeper. You discover that Sunday purchases are a very small sample – only 200 rows out of 500,000 – and those were all from a single promotional event for high-end shoes. The high return rate is not a day-of-week effect; it is an artifact of that specific promotion. Without EDA, you would have built a model that over-predicted returns for all Sunday purchases, which would be wrong.
All of these discoveries happened before you trained a single machine learning model. They directly influenced how you cleaned the data, which features you used, and which patterns the model should focus on. That is the real-world power of EDA.
The MLS-C01 exam tests your understanding of EDA in several specific ways. You will not be asked to write code or manually explore a dataset during the exam. Instead, you will see multiple-choice questions that present scenarios where EDA concepts are applied – or where they were skipped, causing a problem.
Here are the exact topics the exam loves to test:
Missing value detection and treatment. The exam will present a dataset with missing values and ask you what the best next step is. Common traps include "delete all rows with missing values" (sometimes correct, but often wasteful) or "replace missing values with zero" (often wrong because zero changes the meaning). The correct answer usually involves imputation using the mean or median for numeric features, or the mode for categorical features.
Outlier identification. They will show you a box plot or describe a distribution and ask you to identify outliers. The IQR (interquartile range) method is key: any value below Q1 minus 1.5 times IQR, or above Q3 plus 1.5 times IQR, is considered an outlier. Know how to calculate that.
Correlation and multicollinearity. Expect questions where two features are highly correlated (e.g., 0.95 correlation) and you must decide which to remove. The trap is thinking high correlation is always bad – sometimes the model can handle it, but many models like linear regression become unstable. The correct answer often involves removing one of the correlated features to reduce multicollinearity.
Data types and encoding. They will ask how to handle categorical features. The trap is thinking you can feed text categories directly into a model (you cannot). You must encode them, usually with one-hot encoding or label encoding. One-hot encoding creates binary columns for each category. Label encoding assigns a number to each category (e.g., red=1, blue=2, green=3) but this implies an order that may not exist. The exam tests when to use each.
Visualisation choice. They will describe a business question – like "which product category has the highest average sales?" – and ask which visualisation best answers it. A bar chart is correct for comparing categories. A scatter plot is for relationships. A histogram is for distributions. A line chart is for trends over time. The trap is choosing a histogram when a bar chart is needed, or vice versa.
Data imbalance. If a dataset has 99% non-returns and 1% returns, that is imbalanced. The exam will ask you to identify this from a distribution summary and suggest techniques like resampling (oversampling the minority class or undersampling the majority class).
Summary statistics. They will give you a table with mean, median, standard deviation, minimum, and maximum for a feature. You must interpret them. For example, if the mean is much higher than the median, the distribution is right-skewed with high outliers pulling the mean up.
Common trap patterns include:
Confusing correlation with causation. A strong correlation between ice cream sales and drownings does not mean ice cream causes drownings – both are caused by hot weather. The exam loves to test this by asking whether you can conclude a causal relationship. The answer is always no from EDA alone.
Overlooking the difference between training and production data. They might give a scenario where the production data has a different distribution than the training data. EDA in production should be continuous, not a one-time activity.
Assuming all anomalies are errors. Sometimes a real-world anomaly (like a sudden spike in sales during a holiday) is valid and should be kept. The exam tests whether you investigate the anomaly or delete it blindly.
Key definitions to memorise:
IQR = Q3 – Q1. Outliers are beyond 1.5 * IQR from Q1 or Q3.
Skewness: positive skew means tail on the right, mean > median. Negative skew means tail on the left, mean < median.
Standard deviation: average distance of each value from the mean. High standard deviation means values are spread out.
One-hot encoding: creates a separate binary column for each category.
Label encoding: assigns a single integer to each category. Use when categories have an inherent order (e.g., small=0, medium=1, large=2).
Exploratory data analysis is the process of examining raw data to find patterns, spot anomalies, and understand relationships before building a machine learning model.
Missing values, duplicates, and outliers must be identified and handled appropriately; ignoring them will degrade model performance.
Visualisations like histograms, box plots, scatter plots, and heatmaps make patterns visible that are impossible to see in raw numbers alone.
Correlation does not equal causation; a high correlation between two features does not prove one causes the other.
Categorical data must be encoded into numbers (one-hot encoding or label encoding) before most machine learning algorithms can process it.
Data imbalance – where one class is much rarer than another – requires resampling techniques like oversampling the minority class to prevent biased models.
Summary statistics like mean, median, standard deviation, and IQR provide a numerical summary that complements visual findings.
These come up on the exam all the time. Here's how to tell them apart.
Histogram
Shows distribution of a single continuous numeric variable.
Bins values into ranges (e.g., 0-10, 10-20) and counts frequency.
No gaps between bars because data is continuous.
Bar Chart
Compares counts or averages across distinct categories.
Each bar represents a separate category (e.g., red, blue, green).
Has gaps between bars to emphasise categorical separation.
One-Hot Encoding
Creates a separate binary column (0 or 1) for each unique category.
Does not imply any order or ranking between categories.
Increases the number of features (columns) in the dataset.
Label Encoding
Assigns a single integer (1, 2, 3, ...) to each category.
Implies an ordinal relationship that may not exist (e.g., red=1, blue=2 could suggest blue > red).
Does not increase the number of columns; keeps dimensionality low.
Correlation
Measures the strength and direction of a linear relationship between two variables.
Ranges from -1 (perfect negative) to +1 (perfect positive).
Does not prove that one variable causes changes in the other.
Causation
Implies that a change in one variable directly produces a change in another.
Requires controlled experiments or causal inference methods to establish.
Can be falsely assumed when a hidden third variable (confounder) drives both.
Mean Imputation
Replaces missing values with the average of non-missing values.
Sensitive to outliers; a single large outlier can pull the mean significantly.
Best used when data is normally distributed and has no extreme outliers.
Median Imputation
Replaces missing values with the middle value of the sorted data.
Robust to outliers; the median stays stable even with extreme values.
Best used when data is skewed or contains outliers.
Scatter Plot
Displays individual data points as dots on two numeric axes.
Used to see the relationship (correlation) between two variables.
Points are not connected; each dot represents one observation.
Line Chart
Connects data points with a line to show a sequence over time.
Used to visualise trends and changes over a continuous interval.
Assumes an ordered dimension (usually time) on the x-axis.
Mistake
EDA is only about making pretty charts and does not affect the model's accuracy.
Correct
EDA directly impacts model accuracy by revealing missing data, outliers, incorrect encodings, and hidden relationships that would otherwise degrade performance.
Beginners confuse visual appeal with analytical rigour. Charts are tools for discovery, not decoration.
Mistake
If a dataset has no missing values and no outliers, EDA is unnecessary.
Correct
EDA still reveals feature distributions, correlations, and potential data imbalance that affect model choice and feature engineering, even in clean datasets.
People think EDA is only for cleaning, but it is also for understanding the shape and behaviour of the data before modelling.
Mistake
You can skip EDA if you use a tree-based model because those models handle missing values and outliers automatically.
Correct
Tree-based models are more robust to some issues but still suffer from data imbalance, irrelevant features, and misleading correlations that EDA can uncover.
Overconfidence in a model's robustness leads beginners to skip foundational analysis that would improve results.
Mistake
Correlation values of 0.5 or higher always mean one feature causes changes in another.
Correct
Correlation only measures association, not causation. A third unmeasured factor (confounder) or random chance can produce high correlation without a causal link.
The human brain naturally seeks causal explanations, so beginners assume correlation implies causation without evidence.
Mistake
The best way to handle missing values is always to remove the rows with missing data.
Correct
Removing rows can reduce dataset size and introduce bias. Imputation (filling with mean, median, or mode) is often better unless the missingness is random and minimal.
Beginners prioritise simplicity over statistical validity and do not realise that dropping rows can skew the remaining sample.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
No, the exam does not test coding skills. It tests whether you can interpret EDA results, choose the correct visualisation, and decide how to handle data issues based on given scenarios.
A histogram shows the distribution of a continuous numeric variable by grouping values into bins. A bar chart compares the counts or averages of distinct categories.
Remove features with high multicollinearity (correlation above 0.9), features with over 50% missing values, and features that are constant (same value in every row) because they provide no useful information.
An outlier is a value far outside the typical range, often defined as beyond 1.5 times the IQR from the quartiles. Do not always remove outliers – investigate whether they represent real, important phenomena before deciding.
It indicates the distribution is skewed. If the mean is higher than the median, the distribution has a right tail (positive skew) with high outliers pulling the mean upward.
No. Machine learning algorithms require numeric input. You must convert text categories into numbers using one-hot encoding or label encoding first.
You've finished Exploratory Data Analysis and Visualization. Continue through the MLS-C01 study guide to build a complete picture of the exam.
Done with this chapter?