TEC-DATA85-11 · Lesson 3 · 12 clock hours · lab
Exploratory Data Analysis on Urban Datasets
Objective. Students conduct a structured exploratory data analysis (EDA) on their project datasets, producing summary statistics, distribution plots, and a written EDA report that identifies data-quality issues and initial analytical patterns.
⚠ Pending professional review
This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.
VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.
What Is Exploratory Data Analysis?
Exploratory Data Analysis (EDA) is the structured practice of examining a dataset before drawing conclusions or building models. The goal is not to prove a hypothesis — it is to understand what you actually have. In urban data work, raw datasets from city open-data portals, census sources, or municipal APIs often arrive with missing values, inconsistent formatting, and distributions that look nothing like a textbook example. EDA surfaces those problems early so they do not corrupt later analysis.
The Google Data Analytics Certificate frames EDA within the Ask and Prepare phases: you define what question you are trying to answer, then rigorously assess whether the data you have is fit to answer it. CompTIA Data+ Domain 2 (data mining) reinforces this by requiring analysts to profile data, assess completeness, and detect anomalies before any transformation or modeling step.
The Standard EDA Workflow
A reproducible EDA follows a consistent sequence. Working inside a Jupyter Notebook keeps your code, outputs, and narrative in one place, which is essential for a project portfolio.
Step 1 — Data overview. Load the dataset with `pandas` and immediately check its shape (`df.shape`), column names, and data types (`df.dtypes`). Confirm that numeric columns are actually stored as numeric types, not as strings.
Step 2 — Missing-data assessment. Calculate the null percentage for every column: `df.isnull().sum() / len(df) * 100`. Any column missing more than roughly 20–30 percent of its values needs a documented decision — impute, drop, or flag — before analysis proceeds.
Step 3 — Descriptive statistics. Run `df.describe()` for numeric columns and `df.value_counts()` for categorical ones. Note the minimum, maximum, mean, median, and standard deviation. A large gap between mean and median signals a skewed distribution; a minimum of zero in a variable like housing units often indicates a data-entry placeholder rather than a true zero.
Step 4 — Distribution plots. Histograms (via `matplotlib` or `seaborn`) show the shape of each numeric variable. Boxplots reveal the interquartile range and flag potential outliers as points beyond 1.5 times the IQR from the quartile boundaries. For urban datasets — rental prices, commute times, population density — right-skewed distributions are common and meaningful.
Step 5 — Correlation heatmap. Use `seaborn.heatmap(df.corr())` to display pairwise Pearson correlation coefficients. Values near +1 or −1 indicate strong linear relationships; values near 0 suggest little linear association. Remember that correlation does not imply causation, and that non-linear relationships will appear weak here even if they are real.
Interpreting Urban Context
A correlation coefficient or a skewed histogram has no meaning until you connect it to the city question you are investigating. If you are studying neighborhood rent burden and you observe a right-skewed rent distribution, the plain statistical fact is that a small number of high-rent observations pull the mean well above the median. The urban interpretation is that median rent is the more honest measure of what a typical renter pays, and that reporting the mean would overstate affordability. Annotating every plot with one sentence of urban-context interpretation is not optional decoration — it is the analytical habit that separates a data scientist from a spreadsheet operator.
Identifying Data-Quality Issues
At minimum, your EDA report must document at least two data-quality issues. Common ones in municipal datasets include:
- Structural zeros vs. true zeros — a zero in a population column may mean the tract is unpopulated or that the record was not collected.
- Inconsistent geographic identifiers — FIPS codes, ZIP codes, and neighborhood names may overlap or conflict across joined tables.
- Temporal mismatches — datasets collected in different years joined as if they are contemporaneous.
- Outliers from entry error — a property listed at a rent of $1 or $99,999 likely reflects a data-entry convention, not a market price.
Document each issue, note which column it affects, and state your planned treatment.
Revising the Research Question
EDA sometimes reveals that the original research question cannot be answered with the available data. That is a legitimate and important finding, not a failure. If a key variable has 40 percent missing values or is available only at the county level when your question requires the tract level, you must revise the question to match what the data can support. Document the original question and the revised version in your EDA report; reviewers and future employers read this section to assess your analytic judgment.
Data Safety and Professional Responsibility
Urban datasets frequently include personally identifiable information (PII) or quasi-identifiers — small census tracts, exact addresses, income bands — that can re-identify individuals when combined. Before publishing or sharing any EDA output, confirm that your dataset is either fully aggregated or has been cleared for public release by the data provider. Never post raw record-level city data to a public GitHub repository without explicit permission. Store working data files in the designated project folder with access limited to team members. These are professional obligations, not suggestions.
Key terms8
Exploratory Data Analysis (EDA)A structured, preliminary examination of a dataset using summary statistics and visualizations to understand distributions, relationships, and data-quality issues before modeling or inference.
Null percentageThe proportion of missing values in a column, calculated as the count of null entries divided by the total row count, expressed as a percentage.
Descriptive statisticsNumerical summaries of a variable's distribution, including mean, median, standard deviation, minimum, maximum, and quartiles.
Interquartile range (IQR)The difference between the 75th percentile (Q3) and the 25th percentile (Q1) of a distribution; used to define the bounds beyond which data points are flagged as potential outliers.
Correlation heatmapA color-coded matrix displaying pairwise Pearson correlation coefficients for all numeric variables in a dataset, used to identify linear relationships quickly.
Right-skewed distributionA distribution in which the tail extends to the right, meaning a few high values pull the mean above the median; common in income, rent, and property-value data.
Structural zeroA zero value in a dataset that represents a data-collection absence or placeholder rather than a true measurement of zero for that observation.
Quasi-identifierA variable that does not uniquely identify a person on its own but can be combined with other variables to re-identify individuals in a dataset.
Worked examples4
1. A column named 'monthly_rent' in a neighborhood dataset has 1,240 total rows. Running df['monthly_rent'].isnull().sum() returns 186. What is the null percentage, and should the analyst be concerned?
- Null percentage = (number of nulls / total rows) × 100
- Null percentage = (186 / 1240) × 100
- 186 / 1240 = 0.15
- 0.15 × 100 = 15%
Answer: The null percentage is 15%. This is below the common 20–30% concern threshold, but the analyst should still document the issue, check whether nulls cluster in specific neighborhoods (which would introduce bias), and decide on a treatment — such as median imputation or flagging — before proceeding.
2. A boxplot of commute times (in minutes) shows Q1 = 18, Q3 = 42. Calculate the IQR and the upper fence beyond which points are flagged as outliers.
- IQR = Q3 − Q1 = 42 − 18 = 24 minutes
- Upper fence = Q3 + 1.5 × IQR
- 1.5 × 24 = 36
- Upper fence = 42 + 36 = 78 minutes
Answer: The IQR is 24 minutes and the upper outlier fence is 78 minutes. Any commute time recorded above 78 minutes would appear as a point beyond the boxplot whisker and should be investigated — it may reflect a genuine long-distance commuter, a data-entry error, or an unusual record.
3. A rent distribution has a mean of $1,850 and a median of $1,420. What does the relationship between mean and median tell the analyst about the shape of the distribution, and which measure should be reported as typical rent?
- When mean > median, the distribution is right-skewed: a small number of high values pull the mean upward.
- The median divides the distribution in half and is not influenced by extreme high values.
- For a right-skewed variable like rent, the median better represents what a typical renter pays.
- Reporting the mean ($1,850) as 'typical' rent would overstate affordability for most residents.
Answer: The distribution is right-skewed. The median ($1,420) is the appropriate measure of central tendency for this urban housing variable because it is resistant to the influence of a small number of very high-rent properties.
4. A correlation heatmap shows a coefficient of 0.72 between 'median_household_income' and 'park_access_score' across census tracts. A student concludes that higher income causes better park access. Evaluate the student's conclusion.
- A Pearson correlation of 0.72 indicates a moderately strong positive linear relationship between the two variables.
- Correlation measures the degree to which two variables move together; it does not establish which variable causes changes in the other.
- A third variable — such as municipal investment patterns or land values — could be driving both.
- The correct interpretation is that tracts with higher median household income tend to have higher park-access scores, but causality cannot be determined from correlation alone.
Answer: The student's conclusion is not supported. Correlation does not imply causation. The analyst can correctly state that the two variables are positively correlated (r = 0.72) and note that the relationship warrants further investigation, but causal claims require additional study design — such as a regression with controls or a natural experiment.
The math in this lesson1
Learners compute the percent of null values in an urban dataset column.
7.RP.3
In class: Students run a standard EDA script template (value counts, null percentages, descriptive statistics, histograms, boxplots, correlation heatmap) adapted to their datasets in Jupyter Notebook; instructor circulates and prompts with targeted questions about unexpected distributions. · Urban-context interpretation exercise: students annotate each plot with a sentence explaining what the pattern means for the city question (e.g., a right-skewed rent distribution in a neighborhood); annotations are shared in a class stand-up where two peers must ask a clarifying question. · Students draft a two-page EDA report using a provided structure (data overview, key distributions, missing-data assessment, outlier discussion, revised research question if initial framing shifted); report is added to the project portfolio folder.
Materials: Python 3 with pandas, matplotlib, seaborn, scipy; Jupyter Notebook; EDA report template; Google Data Analytics Certificate — Ask and Prepare phases reference notes; CompTIA Data+ domain 2 (data mining) study cards.
Check: EDA report scored on a four-criterion rubric (completeness of statistics, accuracy of plot interpretation, identification of at least two data-quality issues, revised research question if warranted); score of 75% or higher = pass.
Practice check8
Answer each question, then check it. Nothing is recorded; this is your own practice.
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.