Courses / Data Science & ML with AI
Session 3 of 8
Exploratory Data Analysis in Python: Summary Statistics and
Notes
Exploratory Data Analysis in Python: Summary Statistics and Charts That Reveal Patterns
Course: Data Science & ML with AI
Before you start
You need Python 3 with pandas, numpy, scikit-learn and matplotlib installed
(pip install pandas numpy scikit-learn matplotlib). The examples use a small dataset that ships
inside scikit-learn, so there is nothing to download, no account and no API key. You should be able to
read a few lines of Python and know what a DataFrame is. If you have read the earlier chapters you
have met the diabetes dataset and the idea of cleaning a table; this chapter assumes neither beyond
what it restates.
Keep one question in mind while you read: before I fit any model, how do I find out what is in the table, and how do I know that the chart or statistic in front of me tells the truth? By the end you will have a short routine of numbers and charts that answers it, including for a chart suggested by an AI assistant.
Summary
Exploratory data analysis is the look-around you do on a clean table before modelling: summary
statistics that describe each column, charts that show how values are spread, and correlations that
show which columns move together. Each tool answers a different question, so choosing the chart
starts with choosing the question, whether that is “how is this column distributed”, “do these two
columns move together” or “do these groups differ”. Numbers and charts check each other: a chart
suggests a pattern and a statistic confirms or denies it, and a claim that survives only one of the two should not
be trusted. The most common mistakes are reading a mean as “typical” for a lopsided column, taking a
correlation for a cause, and drawing the chart that is easy to draw instead of the one the question needs. This
chapter works through the diabetes dataset with describe(), a histogram, a scatter plot, a box plot and
a correlation table, then trains you to check an AI assistant’s chart suggestion against the numbers.
Key concepts
| Term | Definition |
|---|---|
| Exploratory data analysis (EDA) | Looking at a dataset with summary statistics and charts, before modelling, to learn its shape, its ranges and the relationships between columns. |
| Summary statistics | A few numbers that describe a column: how many values, the average, the spread and the smallest, middle and largest values. |
| Mean and median | The mean is the sum divided by the count; the median is the middle value when the column is sorted. They differ when the values are lopsided. |
| Standard deviation | A measure of spread: roughly how far values typically sit from the mean. A larger number means more spread. |
| Quartiles and IQR | The 25% and 75% quartiles mark the values a quarter of the rows fall below and above. The interquartile range (IQR) is the distance between them. |
| Distribution | How the values of one column are spread over its range: where they pile up, where they thin out and how far the tail runs. |
| Skew | A measure of how lopsided a distribution is. A positive skew means a long tail of large values, which pulls the mean above the median. |
| Histogram | A chart that splits a column’s range into bins and draws a bar for how many rows fall in each. It shows the shape of one column. |
| Scatter plot | A chart with one dot per row, one column on each axis. It shows whether two numeric columns move together. |
| Box plot | A chart of a column’s middle half as a box, with a line at the median and points marking unusually distant values. Good for comparing groups. |
| Correlation | A number from -1 to 1 for how closely two numeric columns move together in a straight line. It says nothing about which one causes the other. |
| Outlier | A value far from the rest of its column. It may be an error or a real, rare case; either way it deserves a look before it is removed or kept. |
Explanations
The failure, before the explanation
An analyst opens the diabetes dataset and wants to know what drives disease progression. She prints
one number for the target, the average, and sees 152.1. She writes “a typical patient scores about
152”. Then she draws the first chart that comes to mind, age against the target, and sees a shapeless
cloud of dots. She concludes “there is no pattern in this data” and moves on.
Both conclusions are wrong. The average is not typical for this column: the middle value is lower,
and the values pile up at the low end with a long tail to the right. And the data does hold a strong
pattern; it just is not in the column she plotted. One column, body mass index, moves with the target
about three times as closely as age does. She would have seen it with one more line of code. The rest
of this chapter shows the routine that finds it, and you will reproduce her 152.1 and find the
pattern she missed.
Load the data and look first
Before any statistic, look at the table. Run this yourself:
import pandas as pd
from sklearn.datasets import load_diabetes
pd.set_option("display.width", 120)
pd.set_option("display.max_columns", 20)
df = load_diabetes(as_frame=True, scaled=False).frame
print(df.shape)
print(df.head().to_string())
print(df.isna().sum().sum(), df.duplicated().sum())
(442, 11)
age sex bmi bp s1 s2 s3 s4 s5 s6 target
0 59.0 2.0 32.1 101.0 157.0 93.2 38.0 4.0 4.8598 87.0 151.0
1 48.0 1.0 21.6 87.0 183.0 103.2 70.0 3.0 3.8918 69.0 75.0
2 72.0 2.0 30.5 93.0 156.0 93.6 41.0 4.0 4.6728 85.0 141.0
3 24.0 1.0 25.3 84.0 198.0 131.4 40.0 5.0 4.8903 89.0 206.0
4 50.0 1.0 23.0 101.0 192.0 125.4 52.0 4.0 4.2905 80.0 135.0
0 0
Two choices here deserve explanation. as_frame=True returns the data as a pandas DataFrame, and its
.frame attribute is one table holding the ten feature columns and the target column together,
which is convenient for exploring. scaled=False asks for the raw measurements. By default the
features are mean-centred and rescaled, which is useful for modelling but would turn the numbers
below into rescaled values rather than measurements; with scaled=False an age is a number of years, and bmi is a
body mass index. The last line tells you the table has no missing values and no duplicate rows (0 0),
so the cleaning from the previous chapter has nothing to do here.
Notice sex: it holds the numbers 1.0 and 2.0. They are codes for two groups, not a quantity, and
the scikit-learn documentation does not say which code is which. A mean of sex would be a
meaningless number; it is useful only to split the rows into two groups.
Summary statistics with describe()
Imagine being handed a spreadsheet of 442 rows and asked to describe it in one breath. You would give,
for each column, how many values there are, where the middle is, how wide the spread is and the two
ends. That is exactly the set of numbers describe() computes. The pandas documentation says it
summarises the central tendency, dispersion and shape of each column’s distribution, leaves out
missing values, and by default analyses only numeric columns.
print(df.describe().T.round(2).to_string())
count mean std min 25% 50% 75% max
age 442.0 48.52 13.11 19.00 38.25 50.00 59.00 79.00
sex 442.0 1.47 0.50 1.00 1.00 1.00 2.00 2.00
bmi 442.0 26.38 4.42 18.00 23.20 25.70 29.28 42.20
bp 442.0 94.65 13.83 62.00 84.00 93.00 105.00 133.00
s1 442.0 189.14 34.61 97.00 164.25 186.00 209.75 301.00
s2 442.0 115.44 30.41 41.60 96.05 113.00 134.50 242.40
s3 442.0 49.79 12.93 22.00 40.25 48.00 57.75 99.00
s4 442.0 4.07 1.29 2.00 3.00 4.00 5.00 9.09
s5 442.0 4.64 0.52 3.26 4.28 4.62 5.00 6.11
s6 442.0 91.26 11.50 58.00 83.25 91.00 98.00 124.00
target 442.0 152.13 77.09 25.00 87.00 140.50 211.50 346.00
.T flips the table so each column of the data becomes a row, which is easier to read when there are
eleven of them. Read one row slowly. For age: all 442 patients have an age, the average is 48.52
years, the standard deviation is 13.11, the youngest is 19 and the oldest is 79. The 25%, 50% and
75% columns are the quartiles (by default describe reports those three percentiles). The 50%
value is the median: half the patients are 50 or younger. The distance from 25% to 75%, here
38.25 to 59.00, is the interquartile range, and it contains the middle half of the rows.
Use the table to check things you can verify by eye. A count below 442 would reveal missing values.
A min or max outside any sensible range, such as an age of 190, would reveal an error. Here nothing
is odd: ages run from 19 to 79 and body mass index from 18.00 to 42.20, a believable range for adults.
The target row is the analyst’s 152.13. Now compare its mean (152.13) with its 50% (140.50).
Mean, median and skew: why the average is not always typical
Picture ten people in a room, nine earning an ordinary salary and one earning a hundred times more. The average income is far above what almost anyone in the room earns, but the middle person’s income still looks ordinary. The mean follows the extreme value; the median does not. When a column is lopsided, the two disagree, and the gap between them is itself a finding.
print(df["target"].mean().round(1), df["target"].median())
print(df.skew().round(2).to_string())
152.1 140.5
age -0.23
sex 0.13
bmi 0.60
bp 0.29
s1 0.38
s2 0.44
s3 0.80
s4 0.74
s5 0.29
s6 0.21
target 0.44
For the target the mean is 152.1 and the median is 140.5, so the mean sits about 11.6 above the
middle. Skew puts a number on this lopsidedness: zero for a symmetric column, positive when a
long tail of large values pulls the mean up, negative for a tail of small values. The pandas
documentation describes skew as the unbiased skew, normalised by N-1. The target’s skew is 0.44, a
mild positive skew, and s3 (the high-density lipoprotein measure) has the largest, 0.80. Use skew as
a pointer, not a verdict: a value near zero means roughly symmetric, a value near 1 or beyond means
you should look at the histogram before quoting an average. Only age is skewed the other way, at
-0.23, a mild tail toward the young.
So the analyst’s “a typical patient scores about 152” overstates it slightly: the middle patient scores 140.5. When you report a centre for a skewed column, give the median, or give both.
Distributions: the histogram
The mean and median say where the middle is; neither shows the shape. A histogram does. Imagine
sorting 442 patients into ten bins by progression score and stacking a block on a shelf for each
patient: the shelf with the most blocks is where the scores pile up. Here are those ten counts,
computed with numpy (the same counts the chart draws), and the code for the chart itself:
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import numpy as np
counts, edges = np.histogram(df["target"], bins=10)
print(counts.tolist())
print(edges.round(1).tolist())
plt.figure()
plt.hist(df["target"], bins=10)
plt.xlabel("progression score")
plt.ylabel("patients")
plt.savefig("target_histogram.png")
[38, 80, 68, 62, 50, 41, 38, 42, 17, 6]
[25.0, 57.1, 89.2, 121.3, 153.4, 185.5, 217.6, 249.7, 281.8, 313.9, 346.0]
(matplotlib.use("Agg") selects a mode that writes a file instead of opening a window, so the code
runs on a machine with no screen; remove those two lines in a notebook to see the chart. The
matplotlib documentation says hist uses numpy.histogram to bin the data, and that with bins=10
you get ten equal-width bins.)
Read the chart through the numbers. The bins are each 32.1 wide, starting at 25. The tallest bar is the second one, scores 57.1 to 89.2, with 80 patients. After that the bars shrink, though not smoothly, and the last two bars (281.8 to 346) hold 17 and 6 patients. The chart is a hill with its peak at the low end and a tail trailing to the right, which is exactly what a positive skew and a mean above the median predicted. Counts and a chart tell the same story; if they did not, you would doubt one of them.
One caution: the number of bins changes the picture. Ten bins here give a clear shape; two bins would hide it and a hundred would show noise. Try 5, 10 and 30 and see which shape survives all three.
Spotting outliers
An outlier is a value far from the rest. Take the s3 column, which has a maximum of 99 while
its middle half runs from 40.25 to 57.75. A common rule of thumb flags values more than 1.5 times the
IQR beyond a quartile; the same rule is the default for the whiskers of a box plot in matplotlib.
q1, q3 = df["s3"].quantile([0.25, 0.75])
upper_fence = q3 + 1.5 * (q3 - q1)
print(q1, q3, round(upper_fence, 2))
print((df["s3"] > upper_fence).sum())
40.25 57.75 84.0
7
Seven patients have an s3 above 84.0. Flagging is not deleting. Those seven could be measurement
errors or genuinely rare patients, and the right step is to look at them, not to drop them. Applying the
same rule to the target finds nothing, since its upper fence is 398.25 and its maximum is 346. An
outlier is a question to ask the data, not a defect to hide.
Relationships: correlation and the scatter plot
Imagine plotting every patient as a dot, body mass index across and progression score up. If dots at
the right tend to sit higher, the two columns move together. A scatter plot draws exactly that,
and correlation is the number that sums it up: 1 means the dots form a perfect rising line, -1 a
perfect falling line, and 0 no straight-line relationship. The pandas documentation says corr
computes pairwise correlation of columns, and by default uses the Pearson method.
corr = df.corr()
print(corr["target"].drop("target").sort_values(ascending=False).round(2).to_string())
bmi 0.59
s5 0.57
bp 0.44
s4 0.43
s6 0.38
s1 0.21
age 0.19
s2 0.17
sex 0.04
s3 -0.39
This is the pattern the analyst missed. Body mass index has a correlation of 0.59 with the target, and
s5 (a log of serum triglycerides) 0.57, while age, the column she plotted, has 0.19. s3 is
negative, -0.39: patients with higher values tend to have lower scores. The sex value of 0.04 is close
to zero, but remember that sex is a code for two groups, so a group comparison tells you more than a
correlation.
Now draw the scatter:
plt.figure()
plt.scatter(df["bmi"], df["target"], alpha=0.5)
plt.xlabel("bmi")
plt.ylabel("progression score")
plt.savefig("bmi_vs_target.png")
The cloud rises from left to right but is wide: patients with a similar body mass index have very different scores. Take the patients whose body mass index is at least 25 and below 26:
similar = df[(df["bmi"] >= 25) & (df["bmi"] < 26)]
print(len(similar), similar["target"].min(), similar["target"].max())
44 25.0 292.0
Those 44 patients have almost the same body mass index, and their scores run from 25 to 292. Computing the averages over the extremes confirms the rising tendency the eye sees:
print(df.loc[df["bmi"] > 35, "target"].agg(["count", "mean"]).round(1).to_string())
print(df.loc[df["bmi"] <= 25, "target"].agg(["count", "mean"]).round(1).to_string())
count 16.0
mean 280.4
count 190.0
mean 109.3
The 16 patients with a body mass index above 35 average a score of 280.4; the 190 patients at 25 or below average 109.3. A correlation of 0.59 is a clear tendency, not a rule: it does not say that raising a patient’s body mass index would raise the score. Correlation is not cause: the two may be linked through something else, and a correlation only measures movement in a straight line, so a curved relationship can have a correlation near zero.
Correlation also exists between the inputs themselves, which matters for modelling:
print(corr.loc["s1", "s2"].round(3))
0.897
s1 (total cholesterol) and s2 (low-density lipoproteins) have a correlation of 0.897, so they
carry much of the same information. A later chapter shows why two inputs this close cause trouble
for some models. For now, notice it: EDA is where you find out.
Comparing groups: the box plot
Suppose you want to know whether the two sex groups differ in progression. A scatter plot is the
wrong tool, as one axis would hold only two values. Compare the groups with numbers first:
print(df["sex"].value_counts().sort_index().to_string())
print(df.groupby("sex")["target"].agg(["count", "mean", "median"]).round(1).to_string())
sex
1.0 235
2.0 207
count mean median
sex
1.0 235 149.0 140.0
2.0 207 155.7 141.0
The pandas documentation describes groupby as splitting the object, applying a function and
combining the results. Here it splits the patients into the two codes and computes the target’s count,
mean and median for each. The groups hold 235 and 207 patients; the means differ by 6.7 and the medians
by 1.0. A box plot shows this as pictures:
groups = [df.loc[df["sex"] == code, "target"] for code in (1.0, 2.0)]
plt.figure()
plt.boxplot(groups, tick_labels=["sex 1", "sex 2"])
plt.ylabel("progression score")
plt.savefig("target_by_sex.png")
You get two boxes that overlap heavily: each box spans the middle half of its group, with a
line at the median, and the two medians (140 and 141) sit almost on top of each other. (The middle
half of the first group runs from 85.5 to 200.0 and of the second from 88.0 to 220.5, computed with
quantile.) The groups look alike in the middle, which agrees with the correlation of 0.04. A chart and a table of numbers giving
the same answer is what you want.
Choosing the chart that matches the question
Pick the chart from the question, not the other way round:
| Your question | Chart | Check it with |
|---|---|---|
| How are the values of one column spread? | Histogram | describe(), mean against median, skew |
| Do two numeric columns move together? | Scatter plot | corr() |
| Does a number differ between groups? | Box plot | groupby(...).agg(...) |
| How do many columns relate to one target? | A sorted correlation table | corr()["target"] |
A pie chart or a line chart over the row number answers none of these for this dataset: the rows are patients in no particular order, so a line through them implies a sequence that does not exist.
With AI: check an assistant’s chart suggestion against the numbers
An assistant can propose charts quickly. What it cannot do is look at your numbers unless you make it, so its suggestion is a hypothesis to test. Here is a reply to the prompt “What chart should I draw to understand what drives diabetes progression in this dataset?”:
Suggestion
- Draw a scatter plot of
ageagainsttarget. Age is the strongest driver of disease progression, so this will show the clearest relationship.- Draw a histogram of
target. The scores are roughly symmetric around the average of about 152, so a bell-shaped curve centred there is what you should expect to see.
The check is the pair of tools this chapter taught: describe() and corr(). Make each claim a
statement you can test, and run the code you have already seen. Try it yourself before reading on.
cols = ["age", "bmi", "bp", "s5"]
print(corr.loc[cols, "target"].round(2).to_string())
print(df["target"].mean().round(1), df["target"].median())
print(counts.tolist())
age 0.19
bmi 0.59
bp 0.44
s5 0.57
152.1 140.5
[38, 80, 68, 62, 50, 41, 38, 42, 17, 6]
Check your work. The suggestion has two flaws:
- Age is not the strongest driver. Its correlation with the target is 0.19, the smallest among
the four columns checked, while
bmiis at 0.59 ands5at 0.57. The scatter of age against target is the chart the analyst drew when she saw nothing. The chart to draw isbmiagainsttarget. - The scores are not symmetric. The mean is 152.1 and the median 140.5, the skew is 0.44, and the histogram counts peak in the second bin (80 patients) and trail off to the right rather than rise and fall evenly around 152. The shape is a hill with a tail, not a bell centred on the average.
The assistant’s claims sound confident and the charts it proposes are legitimate chart types. What was
wrong was the reasoning, and only the numbers could show it. Test each claim an assistant makes about
your data against describe(), skew() and corr() before you draw anything.
Three situations you will meet, and what they mean for your work
Before the table, three situations:
- A colleague quotes the average order value of a shop and a manager says it feels too high: most customers spend much less.
- A dashboard shows two columns whose lines rise together, and a stakeholder asks to act on one to move the other.
- A column has a handful of values ten times the rest, and someone proposes deleting them to “clean up the chart”.
| What you see | EDA idea involved | What to do |
|---|---|---|
| The mean feels wrong for a column (situation 1) | Mean against median, skew | Compare mean with 50% in describe(), check skew(), and report the median or both. |
| Two columns move together (situation 2) | Correlation is not cause | Report the correlation as a tendency, and look for a third factor before saying that one drives the other. |
| A few extreme values (situation 3) | Outliers | Flag them with the IQR rule, look at those rows, and drop them only with a reason you can state. |
Flashcards
Say the answer aloud before revealing it. Speaking it is what exposes the gaps that reading past a written answer hides.
What does describe() report for a numeric column?
The count, mean, standard deviation, minimum, the 25%, 50% and 75% quartiles and the maximum. The 50% value is the median, and missing values are left out of the calculation.
When do the mean and the median of a column differ, and what does it show?
They differ when the values are lopsided. A long tail of large values pulls the mean above the median, as with the diabetes target (152.1 against 140.5), so the average overstates the typical row.
What does a positive skew tell you?
The column has a long tail of large values, so the mean sits above the median. The target’s skew of 0.44 is mild, and a value near 1 or beyond is a prompt to look at the histogram.
What question does a histogram answer?
How the values of one column are spread: where they pile up, where they thin out and how long the tail is. It splits the range into bins and counts the rows in each.
What does a scatter plot show, and which number goes with it?
One dot per row with a column on each axis, so it shows whether two numeric columns move together.
The matching number is the correlation, from corr().
What does a correlation of 0.59 between bmi and the target mean?
The two columns tend to rise together in a straight-line way, fairly closely but not perfectly. It does not say that one causes the other.
Why is "correlation is not cause" more than a slogan?
Two columns can move together because of a third factor, or by chance, so a correlation alone cannot say that changing one will change the other. It is a pointer to investigate.
How do you flag an outlier with the IQR rule?
Compute the quartiles, then flag values beyond 1.5 times the IQR above the upper quartile or below
the lower one. For s3 the upper fence is 84.0 and seven patients exceed it. Look at flagged rows
before deleting any.
Which chart would you use to compare a number between two groups, and how would you check it?
A box plot, with one box per group. Check it with groupby(...).agg(["count", "mean", "median"])
to see the same comparison as numbers.
Why check an assistant's chart suggestion against describe() and corr()?
The assistant writes charts with confidence whether or not its claim about the data is true. The numbers test the claim: here they showed age to be the weakest of the four columns and the target to be lopsided.
Model answer
The question: “You are given a new dataset. How do you explore it before building a model?” A strong answer hits five beats, in this order:
- Look — shape, first rows, types, missing and duplicate counts.
- Summarise —
describe()for count, centre and spread, and mean against median for lopsidedness. - Distributions — histograms and skew for each important column, and a check for outliers.
- Relationships — correlations with the target and between inputs, with scatter plots and group comparisons.
- Check and report — confirm each chart against the numbers, and report tendencies rather than causes.
“I start by looking at the table: its shape, the first rows, the types, and how many values are missing or repeated. Then I run summary statistics to see the count, centre and spread of each column, and I compare the mean with the median to spot lopsided columns. I look at each key column’s distribution with a histogram and flag outliers with the interquartile rule, without deleting them blindly. Then I look at relationships: a sorted correlation table against the target, scatter plots for the strongest pairs, and box plots to compare groups, and I note inputs that are highly correlated with each other. Finally I check every chart against the numbers, and I describe what I found as tendencies, because a correlation is not a cause.”
Missing a beat is a failure state. Without look you analyse a table you have not read. Without summarise you quote an average for a column where it misleads. Without distributions you miss the shape and the outliers. Without relationships you never find the columns that matter, as the analyst missed body mass index. Without check and report a confident chart or a causal claim goes unchallenged, and that is the beat an examiner most often finds missing.
Why this matters
- Finding what matters early. A sorted correlation table and a few charts show in minutes which columns carry the signal, and what to feature-engineer or collect next.
- Not quoting a misleading average. Comparing mean and median before reporting a typical value avoids the commonest error in a business report.
- Catching bad data. A minimum or maximum outside the sensible range, or a cluster of outliers, is often the first sign of an error that cleaning missed.
- Reviewing AI-suggested analysis. An assistant proposes charts and explanations with equal
confidence whether they hold or not;
describe(),skew()andcorr()are how you test them.
After this unit
You can now describe a table with summary statistics, draw the chart that fits a question and check a chart against the numbers. The next chapter prepares the data for a model: scaling and encoding columns and splitting the rows into training and test sets in a way that avoids leaking the answer into the model.
Quiz
Answers are not marked on this page yet. Work through the questions and check the written ones against the criteria printed with each question. The answer key is kept back for now.
Quiz — Exploratory Data Analysis in Python: Summary Statistics and Charts That Reveal Patterns
Instructions: Eight multiple-choice questions. Pick one option per question. Work closed-book, then compare your letters with the answer key, which is held separately and holds the reasons.
1. [recall] A numeric column has a long tail of very large values, with most rows far lower. How do its mean and median usually compare?
a) The mean and the median are equal, because both measure the centre of the column b) The mean is above the median, because the large values pull the average upward c) The mean is below the median, because the many small values pull the average down d) The mean and the median cannot be compared until the column has been scaled
2. [application] A learner wants to see whether two numeric columns, bmi and a progression score,
tend to rise together. Which chart and which number fit that question?
a) A box plot of the score, with the standard deviation of each column
b) A histogram of bmi, with the median of the score for each bin
c) A scatter plot of one column against the other, with their correlation
d) A pie chart of the score values, with the count of rows in each slice
3. [scenario] The describe() output for an age column of a 442-row table shows count 438 and
max 190. What does the analyst conclude?
a) Four values are missing and 190 is not a believable age, so both need investigating
b) The column is skewed to the right, so the median should replace the average
c) The table holds four duplicate rows, which should be removed before charting
d) The column is fine, because describe() leaves out values that are wrong
4. [application] A column has a lower quartile of 40 and an upper quartile of 60. A rule flags values more than 1.5 times the interquartile range above the upper quartile. Above which value is a row flagged?
a) 80, which is the upper quartile plus a single interquartile range b) 120, which is the upper quartile plus three interquartile ranges c) 100, which is the upper quartile plus two interquartile ranges d) 90, which is the upper quartile plus one and a half ranges
5. [recall] Two columns in a table have a correlation of 0.59. Which statement is correct?
a) A change in the first column is the reason the second one changes b) About 59 of every 100 rows in the table fall on a straight line c) The two columns tend to rise together, though not in a perfect line d) The relationship is curved, because the number is well below 1
6. [scenario] A dashboard shows that monthly ice-cream sales and monthly swimming accidents have a correlation of 0.8. A manager proposes stopping ice-cream sales to reduce accidents. What should the analyst say?
a) The correlation is high enough to show that ice cream causes the accidents b) The columns move together, but a third factor such as hot weather may explain both c) The correlation only counts once the two columns have been plotted on a histogram d) A value of 0.8 is too close to 1, so the data must contain an error to be fixed
7. [scenario] An assistant says a revenue column is “roughly symmetric, so the average is a good
typical value”. describe() shows a mean of 5,200, a median of 3,100 and a maximum far above the 75%
value. What should the analyst do?
a) Accept the claim, because the mean is the standard way to report a centre b) Delete the rows above the 75% value so that the column becomes symmetric c) Replace the column with its standard deviation, which removes the lopsidedness d) Reject the claim, check the histogram and skew, and report the median
8. [application] An analyst wants to know whether a numeric target differs between two groups of patients, and to back the picture with numbers. Which pair does that?
a) A box plot with one box per group, and the target’s mean and median for each group b) A scatter plot of the group code against the target, and one correlation for the table c) A histogram of the group code, and the count of rows in each group d) A line chart of the target in row order, and the maximum for each group
Want help building this with someone?
Tell us what you are working on and we will write back about a mentor-led cohort, live sessions or 1:1 training. It is only an enquiry: you choose whether to go further.
Ask about mentor-led trainingTechEazy Consulting training material — not affiliated with or endorsed by pandas, scikit-learn or any other project or company named in this course.