Exploratory Data Analysis | data mining!

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/23

flashcard set

Earn XP

Description and Tags

created by claude

24 Terms

1
New cards

What is exploratory data analysis (EDA)?

Looking at data before modeling it: checking shape, errors, outliers, and relationships.

2
New cards

What's a CS analogy for EDA?

Profiling before optimizing: you don't model data you haven't looked at.

3
New cards

What's the first step in choosing a plot?

Label each variable as numeric or categorical, then pick the plot for that combination.

4
New cards

Which plot shows one numeric column?

A histogram (or a boxplot).

5
New cards

Which plot shows one categorical column?

A bar chart of counts: df["col"].value_counts().plot.bar()

6
New cards

Which plot compares a numeric variable across categories?

Side by side boxplots, one box per category.

7
New cards

Which plot shows the relationship between two numeric variables?

A scatterplot.

8
New cards

How do you compare two categorical variables?

A crosstab: pd.crosstab(df["a"], df["b"], normalize="index"), or a grouped bar chart.

9
New cards

Why is a scatterplot a bad choice for hours_per_week vs income?

income is categorical, so the plot collapses into two vertical stripes of overlapping dots. Use side by side boxplots.

10
New cards

Why can't you use a boxplot for sex vs income?

A boxplot needs a numeric variable, and both are categorical. Use a crosstab.

11
New cards

Which seaborn function draws a histogram?

sns.histplot (not histoplot).

12
New cards

Application: write the code for the distribution of age.

sns.histplot(data=df, x="age")

13
New cards

Application: write the code to compare hours_per_week between income groups.

sns.boxplot(data=df, x="income", y="hours_per_week")

14
New cards

Application: write the code for age vs hours_per_week.

sns.scatterplot(data=df, x="age", y="hours_per_week")

15
New cards

Application: write the code for the share of >50K earners by sex.

pd.crosstab(df["sex"], df["income"], normalize="index")

16
New cards

In seaborn, why does data="df" fail?

It passes the string "df", not the DataFrame. Use data=df with no quotes.

17
New cards

Is ">50K" a column name in the Adult dataset?

No. It's a value in the income column, so use df["income"]. Run df.columns when unsure.

18
New cards

What is Anscombe's quartet?

Four datasets with nearly identical means, SDs, and correlation that look completely different when plotted.

19
New cards

What does Anscombe's quartet teach?

Summary statistics hide shape, outliers, and curves. Plot first, because the plot tells you which model to use.

20
New cards

Do mean and SD describe a dataset's shape?

No. Skew, multiple peaks, and outliers are invisible to them.

21
New cards

Does reporting a standard deviation mean the data is bell shaped?

No. SD can be computed on any data.

22
New cards

Application: the Adult age histogram has a spike at exactly 90. What's the likely cause?

Capping (top coding): everyone 90 or older was recorded as 90.

23
New cards

Why wouldn't df.describe() reveal the spike at age 90?

It reports only about 8 numbers, and max = 90 looks perfectly normal. Only a plot shows hundreds of people sitting at 90.

24
New cards

What does df.info() catch during EDA?

Column types, such as zip codes loaded as int64.