DSA 223 - Data Analysis and Visualization: Exam
Study Notes
Programme: DDA Course: DSA 223 - Data Analysis and Visualization
Author: Manus AI
Introduction: How to Use These Notes
Welcome! These notes are designed for someone who feels they know nothing
about data analytics and visualization. We will explain everything using simple
language, everyday examples, and clear definitions.
How to study:
1 Read through each week's section.
2 Pay special attention to the "Definitions" and "Examples" to build your
understanding.
3 Memorize the "Exam Tips / Key Points to Remember" for each section,
as these are high-probability exam topics.
4 Look at the comparison tables to understand the differences between
concepts (this is a common exam question format).
5 Review the Python code snippets to understand how these concepts are
applied in practice.
6 Use the Quick-Reference Cheat Sheet at the end for last-minute revision.
Week 1: Introduction to Data Analysis and Visualization
Importance of Data Analysis
Data analysis is the process of inspecting, cleansing, transforming, and
modeling data to discover useful information, inform conclusions, and support
decision-making.
In simple terms, it's about taking a messy pile of information (data) and finding
the story or the answers hidden inside it. For example, a shop owner looks at
sales records (data) to figure out which products sell best during winter, so they
can stock up next year. This helps them make better business decisions.
Life-cycle of Data Analysis
The life-cycle of data analysis describes the step-by-step process of working
with data. Think of it like cooking a meal:
7 Define the Problem (The Recipe): What question are we trying to
answer? (e.g., "Why are sales dropping?")
8 Data Collection (Buying Ingredients): Gathering the raw data needed.
9 Data Preprocessing (Prepping Ingredients): Cleaning the data,
removing errors, and filling in missing pieces.
10 Exploratory Data Analysis (EDA) (Tasting): Exploring the data to
understand its characteristics and find initial patterns.
11 Data Modeling/Analysis (Cooking): Applying statistical or machine
learning techniques to find deeper insights.
12 Data Visualization and Reporting (Plating and Serving): Creating
charts and graphs to present the findings clearly.
13 Actionable Insights (Eating and Learning): Using the results to make
decisions or take action.
Types of Data
Data comes in many forms. Understanding these types is crucial for exams.
• Structured Data: Data that is highly organized and easily searchable. It
usually fits neatly into rows and columns (like an Excel spreadsheet).
◦ Example: A database of customer names, ages, and purchase dates.
• Unstructured Data: Data that does not have a predefined format. It's
messy and harder to analyze.
◦ Example: Emails, social media posts, images, videos, or text
documents.
• Categorical Data: Data that represents categories or groups.
◦ Example: Eye color (blue, green, brown), or product type
(electronics, clothing, food).
• Numerical Data: Data that represents numbers and can be measured.
◦ Discrete: Countable numbers (e.g., number of students in a class:
25, 30).
◦ Continuous: Measurable numbers that can have decimals (e.g.,
height, weight, temperature).
Data Type Description Example Key Characteristic
Organized, Excel file of bank Easy to search and
Structured
rows/columns transactions analyze
Disorganized, no fixed Requires complex
Unstructured Text messages, photos
format processing
Car brands (Toyota, Cannot be added or
Categorical Categories or labels
Ford) subtracted
Numerical Countable whole
Number of pets No fractions
(Discrete) numbers
Numerical Measurable, can have
Temperature (23.5°C) Infinite possibilities
(Continuous) decimals
Introduction to Data Visualization Principles
Data visualization is the graphical representation of information and data. By
using visual elements like charts, graphs, and maps, data visualization tools
provide an accessible way to see and understand trends, outliers, and patterns in
data.
Key Principles:
• Clarity: The main goal is to communicate information clearly and
efficiently. Avoid clutter.
• Accuracy: Visuals must accurately represent the data without distortion.
• Simplicity: Keep it simple. Don't use too many colors or complex 3D
effects if they don't add value.
Exam Tips / Key Points to Remember
• Remember the 7 steps of the data analysis life-cycle and be able to
explain them simply.
• Be able to give examples of structured vs. unstructured data and
categorical vs. numerical data.
• Understand that visualization is about making data easier to understand
and spotting trends quickly.
Week 2: Data Collection and Preprocessing
Data Collection Methods
Before you can analyze data, you have to get it. There are two main ways:
14 Primary Data: Data you collect yourself for a specific purpose.
◦ Methods: Surveys, interviews, observations, experiments.
◦ Example: Sending out a customer satisfaction survey to people
who visited your website today.
15 Secondary Data: Data that someone else has already collected.
◦ Methods: Government statistics (census data), company reports,
academic research.
◦ Example: Using the national census data to study population
trends.
Cleaning and Handling Missing Data
Raw data is rarely perfect. It's often "dirty," meaning it has errors, duplicates, or
missing values. Data cleaning is the most time-consuming part of the process
but is essential for accurate analysis.
Common Issues and Solutions:
• Missing Data: Sometimes a field is left blank.
◦ Solution 1 (Delete): If there's very little missing data, you can
delete the entire row.
◦ Solution 2 (Impute/Fill): Fill the missing value with an average
(mean), median, or mode of the other values in that column.
• Duplicates: The same record appears multiple times.
◦ Solution: Remove the duplicate rows.
• Inconsistencies: For example, one record says "USA" and another says
"United States".
◦ Solution: Standardize the format (e.g., change all to "USA").
Introduction to Data Formats
Data is stored in different file formats. You need to know the most common
ones:
• CSV (Comma-Separated Values): The most common format for storing
tabular data (numbers and text). Each value is separated by a comma. It's
plain text and can be opened by almost any program.
◦ Example: Name, Age, City \n Alice, 25, New York
• XLSX / XLS: These are Excel workbook formats. They can contain
multiple sheets, formulas, and formatting, unlike CSV.
• JSON (JavaScript Object Notation): A lightweight data-interchange
format often used for web APIs. It looks like nested key-value pairs.
◦ Example: {"name": "Alice", "age": 25, "city": "New York"}
Format Full Name Key Features Best Used For
Comma-Separated Simple, plain text, one sheet, Simple data exchange,
CSV
Values separated by commas basic datasets
XLSX/ Multiple sheets, supports Complex data, business
Excel Workbook
XLS formulas and formatting reports
JavaScript Object Hierarchical, key-value pairs, Web APIs, complex
JSON
Notation web-friendly nested data
Exam Tips / Key Points to Remember
• Know the difference between primary and secondary data collection
methods.
• Understand why data cleaning is necessary (dirty data leads to wrong
conclusions).
• Be able to explain what a CSV file is and why it's popular (simple,
universally supported).
Week 3: Exploratory Data Analysis (EDA)
Descriptive Statistics
Descriptive statistics are used to summarize and describe the main features of a
dataset. Think of it as a "snapshot" or a summary of your data.
• Mean (Average): The sum of all values divided by the number of values.
◦ Example: Grades of 80, 90, 100. Mean = (80+90+100)/3 = 90.
• Median: The middle value when the data is sorted in order.
◦ Example: Grades of 80, 85, 90, 95, 100. Median = 90. (Useful
when there are extreme outliers, like a grade of 0).
• Mode: The most frequently occurring value.
◦ Example: Grades of 80, 90, 90, 95. Mode = 90.
• Variance: A measure of how spread out the data is from the mean.
• Standard Deviation: The square root of the variance. It's the most
common way to measure spread. A low standard deviation means data
points are close to the mean; a high one means they are spread out.
Summarizing Datasets with Tables and Graphs
EDA involves creating visual summaries to understand the data.
• Tables: Frequency tables show how often each value or category
appears.
• Graphs: Histograms (for numerical data), bar charts (for categorical
data), and pie charts are used to get a quick visual overview.
Identifying Trends, Patterns, and Anomalies
• Trends: A general direction in which something is developing or
changing over time. (e.g., Sales increasing every December).
• Patterns: Repeated regularities in the data. (e.g., Website traffic is
highest on weekdays between 9 AM and 5 PM).
• Anomalies (Outliers): Data points that deviate significantly from the rest
of the dataset. (e.g., A 25-year-old earning $500,000 a year in a dataset of
average earners). You must investigate these; sometimes they are errors,
sometimes they are important discoveries.
Exam Tips / Key Points to Remember
• Know how to calculate or define Mean, Median, and Mode.
• Understand the difference between Variance and Standard Deviation
(Standard Deviation is just the square root of Variance, and both measure
spread).
• Define "outlier" or "anomaly" and explain why it's important to find them
during EDA.
Week 4: Introduction to Data Visualization Tools
Overview of Visualization Tools
There are many tools available for creating visualizations, ranging from simple
spreadsheet software to powerful programming libraries.
• Matplotlib: A foundational Python library for creating static, animated,
and interactive visualizations. It's very powerful but requires a lot of code
for basic charts.
• Seaborn: Built on top of Matplotlib, Seaborn makes it easier to create
statistically informative and attractive visualizations. It uses fewer lines
of code and has better default styles.
Basic Chart Creation
Understanding which chart to use for what data is a fundamental skill.
• Bar Chart: Used to compare different categories.
◦ Example: Comparing sales revenue for different products (Phone,
Laptop, Tablet).
• Line Graph: Used to show trends over time.
◦ Example: Showing the stock price of a company over a year.
• Pie Chart: Used to show parts of a whole (percentages).
◦ Example: Showing the market share of different web browsers
(Chrome, Safari, Firefox).
Chart
Best Used For Data Type Example
Type
Bar Chart Comparing categories Categorical Sales by department
Line Numerical Temperature over a
Showing trends over time
Graph (Continuous) month
Showing proportions/parts of a Market share by
Pie Chart Categorical
whole company
Exam Tips / Key Points to Remember
• Know the difference between Matplotlib and Seaborn (Seaborn is built on
Matplotlib and is easier/better for statistics).
• Be able to match the chart type to the purpose (e.g., "If I want to show
change over time, I should use a line graph").
Week 5: Data Visualization Techniques I
Best Practices for Creating Effective Visualizations
A good visualization tells a story clearly.
• Choose the Right Chart: As discussed in Week 4, don't use a pie chart
to show a trend over time.
• Label Everything: Axes must have clear titles and units.
• Avoid "Chart Junk": Remove unnecessary gridlines, 3D effects, or
distracting colors.
• Use Color Wisely: Color should highlight important data, not just make
it pretty. Use colors that are colorblind-friendly if possible.
Visualizing Distributions and Relationships
• Histogram: Shows the distribution of a single numerical variable. It
looks like a bar chart, but the x-axis is continuous (like ranges of age: 0-
10, 11-20, 21-30).
◦ Example: Showing how many students fall into different grade
ranges (A, B, C, D, F).
• Scatter Plot: Shows the relationship between two numerical variables.
Each point represents an observation.
◦ Example: Plotting height (x-axis) vs. weight (y-axis) to see if taller
people generally weigh more.
Exam Tips / Key Points to Remember
• Define "Chart Junk" and explain why avoiding it is important.
• Understand the difference between a Bar Chart (categories) and a
Histogram (distribution of continuous data).
• Know that Scatter Plots are used to look for relationships/correlations
between two numerical variables.
Week 6: Data Visualization Techniques II
Advanced Visualization Techniques
When data gets complex, simple bar and line charts aren't enough.
• Heatmap: Uses color to represent the value of a matrix or table. Darker
or more intense colors usually mean higher values.
◦ Example: A correlation matrix showing how strongly different
variables are related to each other. Or a map showing temperature
changes across a country (red for hot, blue for cold).
• Box Plot (Box-and-Whisker Plot): Shows the distribution of data based
on a five-number summary: minimum, first quartile (Q1), median, third
quartile (Q3), and maximum. It's excellent for spotting outliers.
◦ Example: Comparing the salaries of different job roles across
multiple companies.
• Violin Plot: A combination of a box plot and a kernel density plot. It
shows the distribution of the data (like a histogram turned sideways)
along with the summary statistics of a box plot.
◦ Example: Comparing the distribution of test scores between two
different classes, showing where most students scored (the widest
part of the violin).
Customizing and Annotating Visualizations
To make your charts more informative, you can customize them.
• Annotations: Adding text or arrows to point out specific, important data
points on the chart.
◦ Example: Adding an arrow pointing to a sudden spike in sales on a
line graph and writing "Holiday Sale Started".
Exam Tips / Key Points to Remember
• Know the specific use cases for Heatmaps (showing
relationships/intensity), Box Plots (showing distribution and outliers), and
Violin Plots (showing distribution shape).
• Understand what annotations are and why they are used (to draw
attention to key insights).
Week 7: Statistical Data Analysis
Descriptive vs. Inferential Statistics
Week 3 covered descriptive statistics (summarizing the data you have). Week 7
covers inferential statistics (using your sample data to make guesses about a
larger population).
• Population: The entire group you want to study (e.g., all adults in a
country).
• Sample: A smaller group taken from the population to represent it (e.g.,
1,000 adults surveyed).
Inferential Statistics
• Confidence Interval: A range of values that is likely to contain the true
population value.
◦ Example: "We are 95% confident that the average height of all
adults is between 170cm and 175cm."
• Hypothesis Testing: A formal process to test a claim about a population
using sample data.
◦ Null Hypothesis (H0): The default assumption (e.g., "The new drug
has no effect").
◦ Alternative Hypothesis (H1): What you are trying to prove (e.g.,
"The new drug is effective").
• P-value: A number that tells you how likely it is to see your results if the
null hypothesis is true. A low p-value (usually < 0.05) means your results
are statistically significant, so you reject the null hypothesis.
◦ Simple term: If p-value is low, the null hypothesis must go.
Correlation and Regression Analysis
• Correlation: Measures the strength and direction of a relationship
between two variables.
◦ Ranges from -1 to 1.
◦ 1: Strong positive (as one goes up, the other goes up).
◦ -1: Strong negative (as one goes up, the other goes down).
◦ 0: No correlation.
• Regression Analysis: A statistical method used to estimate the
relationships among variables. It's often used for prediction.
◦ Example: Predicting house prices based on size, number of
bedrooms, and location.
Concept Purpose Key Question it Answers
Confidence Estimate population "What is the range where the true average
Interval parameter likely falls?"
Hypothesis "Is there enough evidence to support this
Test a claim
Testing claim?"
Correlation Measure relationship "How strongly are these two things related?"
Regression Predict outcomes "If X happens, what will Y be?"
Exam Tips / Key Points to Remember
• Clearly distinguish between Descriptive (summarizing) and Inferential
(predicting/testing) statistics.
• Understand the concept of a p-value (low p-value = significant result).
• Know the difference between correlation (measuring relationship) and
regression (predicting).
Week 8: Programming for Data Analysis and
Visualization
Introduction to Python
Python is a popular programming language for data analysis because it is easy
to read and has powerful libraries (tools).
• Libraries: Pre-written collections of code that you can use without
writing everything from scratch.
◦ Pandas: For data manipulation and analysis (like Excel in code).
◦ Matplotlib / Seaborn: For creating visualizations.
Importing and Manipulating Data (Pandas)
Pandas is the most important library for handling data in Python. Data is stored
in a DataFrame (a table).
# Import the pandas library
import pandas as pd
# Read a CSV file into a DataFrame (a table)
df = pd.read_csv('sales_data.csv')
# Display the first 5 rows of the data
print([Link]())
# Get basic statistics about the numerical columns
print([Link]())
# Check for missing values
print([Link]().sum())
# Drop rows with missing values
df_clean = [Link]()
Basic Plotting Libraries (Matplotlib/Seaborn)
# Import matplotlib for basic plotting
import [Link] as plt
# Import seaborn for statistical plotting
import seaborn as sns
# --- Matplotlib Example: Simple Bar Chart ---
categories = ['A', 'B', 'C']
values = [10, 20, 15]
[Link](categories, values)
[Link]('Simple Bar Chart')
[Link]() # This displays the chart
# --- Seaborn Example: Scatter Plot ---
# Assuming 'df' is your pandas DataFrame with 'height' and 'weight' columns
[Link](x='height', y='weight', data=df)
[Link]('Height vs Weight')
[Link]()
Saving and Exporting Visualizations
You don't just want to show charts on screen; you want to save them for reports.
# Save a Matplotlib chart as an image file (PNG)
[Link](categories, values)
[Link]('my_bar_chart.png', dpi=300, bbox_inches='tight') # dpi=300
makes it high quality
[Link]() # Close the plot to free up memory
Exam Tips / Key Points to Remember
• Know the primary purpose of the main libraries: Pandas (data
manipulation), Matplotlib/Seaborn (visualization).
• Understand what a DataFrame is (a tabular data structure in Pandas).
• Be able to recognize basic Pandas functions: read_csv(), head(),
describe(), dropna().
• Know how to save a plot using [Link]().
Week 9: Storytelling with Data
Crafting Compelling Narratives with Data
Data storytelling is about translating data analysis into a narrative that people
can understand and act upon. It's not just about showing numbers; it's about
answering "So what?"
• The Narrative Arc: Like a story, your data presentation should have a
beginning (context), middle (the data/analysis), and end (the
conclusion/action).
• Context is King: Don't just say "Sales increased by 10%." Say "Despite a
market downturn, sales increased by 10% due to our new marketing
campaign."
Choosing Visuals for Storytelling
The type of chart you choose shapes the story you tell.
• Timeline: Used to show history or progression. (e.g., A line chart
showing the company's growth since founding).
• Hierarchy: Used to show parts of a whole or levels of importance. (e.g.,
A treemap showing budget allocation across departments).
• Flow: Used to show movement or processes. (e.g., A Sankey diagram
showing how website visitors move from page to page).
Using Color, Labels, and Annotations Effectively
• Color: Use color to highlight the most important part of the story. If
everything is bright, nothing stands out. (e.g., Make all bars grey except
the one representing the current year, which is bright blue).
• Labels: Titles should state the main takeaway, not just describe the chart.
◦ Bad: "Sales by Year"
◦ Good: "Sales Doubled in 2023 After New Marketing Strategy"
• Annotations: Use text on the chart to explain why a spike or drop
happened.
Exam Tips / Key Points to Remember
• Data storytelling is about making data actionable and understandable.
• Understand how color and annotations are used to guide the audience's
attention to the key insight.
• Know that chart titles should be descriptive of the insight, not just the
data type.
Week 10: Case Studies and Real-World Applications
Analysing Datasets from Various Domains
Data analysis is used everywhere. Understanding the context of the data is
crucial.
• Healthcare: Predicting patient readmissions, analyzing the effectiveness
of treatments, tracking disease outbreaks.
◦ Challenge: Data privacy (HIPAA compliance) and messy,
unstructured data (doctor's notes).
• Finance: Fraud detection, algorithmic trading, credit scoring.
◦ Challenge: High-frequency data, extreme market volatility,
regulatory compliance.
• Marketing: Customer segmentation, analyzing campaign ROI,
predicting customer churn (who will leave).
◦ Challenge: Tracking users across different platforms, attribution
modeling (which ad actually caused the sale?).
Discussion of Challenges and Solutions in Real-World Projects
Real-world projects are rarely clean.
• Challenge: Missing or inaccurate data.
◦ Solution: Robust data cleaning processes, using proxy variables, or
advanced imputation techniques.
• Challenge: Scalability (Data is too big for one computer).
◦ Solution: Using cloud computing (AWS, Google Cloud) or big
data frameworks (Apache Spark, Hadoop).
• Challenge: Explaining complex models to non-technical stakeholders.
◦ Solution: Strong data visualization and storytelling skills (Week 9).
Exam Tips / Key Points to Remember
• Be prepared to discuss how data analysis is applied in specific fields
(Healthcare, Finance, Marketing).
• Understand common real-world challenges (dirty data, scale,
communication) and potential solutions.
Quick-Reference Summary / Cheat Sheet
Use this section for rapid review before the exam.
Core Definitions
• Data Analysis: Process of cleaning, transforming, and modeling data to
discover useful information.
• Data Visualization: Graphical representation of data to make it easier to
understand.
• Structured Data: Organized in rows/columns (e.g., SQL database,
CSV).
• Unstructured Data: No predefined format (e.g., text, images).
• Outlier: A data point that differs significantly from other observations.
The Data Life-Cycle (Remember the Flow)
16 Define Problem -> 2. Collect -> 3. Clean (Preprocess) -> 4. Explore
(EDA) -> 5. Analyze/Model -> 6. Visualize -> 7. Act
Descriptive Statistics
• Mean: Average
• Median: Middle value
• Mode: Most frequent value
• Standard Deviation: How spread out the data is.
Chart Cheat Sheet
Need to show... Use this chart...
Trends over time Line Graph
Comparing categories Bar Chart
Parts of a whole Pie Chart
Distribution of data Histogram
Relationship between 2 variables Scatter Plot
Relationships/Intensity (matrix) Heatmap
Distribution & Outliers Box Plot
Key Python Libraries
• Pandas: Data manipulation (pd.read_csv(), DataFrames).
• Matplotlib: Basic plotting ([Link](), [Link]()).
• Seaborn: Statistical plotting, built on Matplotlib ([Link]()).
Statistics Cheat Sheet
• Inferential Stats: Using a sample to make claims about a population.
• P-value: Probability that the results happened by chance. Low p-value
(<0.05) = Significant.
• Correlation: How two variables relate (-1 to 1).
• Regression: Predicting one variable based on others.
End of Study Notes