Exploratory Data Analysis
- 55Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
Why does the analysis use frequency tables for some variables and correlation for others?
Why does the analysis use frequency tables for some variables and correlation for others?
55 questions
- 1
Why does the analysis use frequency tables for some variables and correlation for others?
- A
Both methods require every variable to be categorical
- B
Both methods are used only to summarize missing values
- C
Frequency tables examine categorical variables, while correlation measures association between numerical variables
- D
Frequency tables examine numerical variables, while correlation measures association between categorical variables
Correct answer
CFrequency tables examine categorical variables, while correlation measures association between numerical variables
Explanation
The lecture uses frequency tables and cross-tabulation to examine categorical variables, and correlation to examine the association between numerical variables.
- A
- 2
Which library is used to change the working directory in the analysis?
- A
The
matplotliblibrary - B
The
numpylibrary - C
The
pandaslibrary - D
The
oslibrary
Correct answer
DThe
oslibraryExplanation
The
oslibrary is used withos.chdirto change the working directory. - A
- 3
Why is pandas imported as
pd?- A
pdconverts all imported columns into categorical variables - B
pdis a convenient alias used to refer to pandas functions - C
pdautomatically removes missing records from every data frame - D
pdchanges the working directory before reading data
Correct answer
Bpdis a convenient alias used to refer to pandas functionsExplanation
The lecture uses
pdas a short alias for the pandas library. - A
- 4
Which pandas function is appropriate for reading a CSV file such as
Toyota.csv?- A
pd.copy_csv - B
pd.chdir - C
pd.crosstab - D
pd.read_csv
Correct answer
Dpd.read_csvExplanation
The data is stored as a CSV file, so the lecture reads it using pandas'
read_csvfunction. - A
- 5
What is the purpose of setting
index_col=0when reading the car data?- A
It removes the first row because it contains missing values
- B
It uses the first column of the CSV as the data frame's index
- C
It sorts the data by the first column
- D
It converts the first column into a frequency table
Correct answer
BIt uses the first column of the CSV as the data frame's index
Explanation
Setting
index_col=0specifies that the first column should serve as the data frame's index. - A
- 6
Why are question-mark strings specified as missing-value markers while reading the file?
- A
They represent a special fuel type that must be retained as a category
- B
They indicate that the corresponding records should become the data frame index
- C
They instruct pandas to convert the entire column to text
- D
They do not convey usable data values and can be treated as standard missing values
Correct answer
DThey do not convey usable data values and can be treated as standard missing values
Explanation
The question marks are not meaningful data values, so the lecture treats them as missing values to enable standard missing-data handling.
- A
- 7
What is the main reason for making a copy of the original data frame before analysis?
- A
To make changes to a separate data frame while preserving the original for comparison
- B
To automatically replace all missing values with zeros
- C
To reduce the number of rows before creating tables
- D
To convert all variables into numerical data
Correct answer
ATo make changes to a separate data frame while preserving the original for comparison
Explanation
Working on a copy keeps modifications from affecting the original data and allows the original to be used for cross-checking.
- A
- 8
What does
cars_data2 = cars_data.copy()accomplish in the lecture's workflow?- A
It removes every row that contains a missing value
- B
It creates a frequency table of the car variables
- C
It creates a separate data frame copied from
cars_data - D
It changes the working directory to the data folder
Correct answer
CIt creates a separate data frame copied from
cars_dataExplanation
The
copyfunction creates a new data frame that can be used for analysis without modifying the original. - A
- 9
What is the purpose of a univariate frequency table for a categorical variable?
- A
To replace each category with a numerical measurement
- B
To show the correlation between that variable and every numerical variable
- C
To calculate the conditional probability for every pair of categories
- D
To show the count of records in each category of that variable
Correct answer
DTo show the count of records in each category of that variable
Explanation
A univariate frequency table summarizes how many observations fall into each category of one categorical variable.
- A
- 10
Which function does the lecture use to create both one-way frequency tables and two-way tables?
- A
DataFrame.copy - B
pd.read_csv - C
pd.crosstab - D
os.chdir
Correct answer
Cpd.crosstabExplanation
The lecture uses pandas'
crosstabfunction for frequency tables and cross-tabulations. - A
- 11
When Fuel Type is supplied as the index to
pd.crosstab, what does the resulting one-way table report?- A
The correlation between Fuel Type and gearbox type
- B
The number of missing columns in each Fuel Type category
- C
The average price of cars in each Fuel Type category
- D
The count of records in each Fuel Type category
Correct answer
DThe count of records in each Fuel Type category
Explanation
With Fuel Type as the single index variable, the table gives the frequency of each category of Fuel Type.
- A
- 12
What is the purpose of setting
dropna=Truewhen creating the Fuel Type frequency table?- A
To remove duplicate Fuel Type categories from the data frame
- B
To exclude records with missing Fuel Type values from the frequency counts
- C
To convert category counts into proportions that sum to one
- D
To add missing Fuel Type values as a new category in the table
Correct answer
BTo exclude records with missing Fuel Type values from the frequency counts
Explanation
The setting excludes records with missing values for the variable being tabulated, so only non-missing Fuel Type records contribute to the counts.
- A
- 13
The car data contains 1,436 rows, and 100 records have missing Fuel Type values. How many records remain for a frequency table that drops those missing values?
- A
100
- B
1,336
- C
1,536
- D
1,436
Correct answer
B1,336
Explanation
Dropping the 100 records with missing Fuel Type leaves 1436−100=1336 records.
- A
- 14
Among the non-missing Fuel Type records, which category is most frequent in the lecture's example?
- A
CNG, with 144 records
- B
Petrol, with 144 records
- C
Petrol, with 1,177 records
- D
Diesel, with 1,177 records
Correct answer
CPetrol, with 1,177 records
Explanation
The example reports 1,177 petrol cars, compared with 144 diesel cars and 15 CNG cars.
- A
- 15
In the car data, what do the values 0 and 1 in the
Automaticvariable represent?- A
0 represents a missing gearbox, and 1 represents a manual gearbox
- B
0 represents a manual gearbox, and 1 represents an automatic gearbox
- C
0 represents an automatic gearbox, and 1 represents a manual gearbox
- D
0 represents a petrol car, and 1 represents a diesel car
Correct answer
B0 represents a manual gearbox, and 1 represents an automatic gearbox
Explanation
The lecture defines 0 as a manual gearbox and 1 as an automatic gearbox.
- A
- 16
In a cross-tabulation with
Automaticas the index and Fuel Type as the columns, what does a cell represent?- A
The correlation between the row's gearbox type and the column's Fuel Type
- B
The number of records with the row's gearbox type and the column's Fuel Type
- C
The number of missing records in the row's gearbox type
- D
The average price for the row's gearbox type and the column's Fuel Type
Correct answer
BThe number of records with the row's gearbox type and the column's Fuel Type
Explanation
Each cell counts records that have the gearbox type named by its row and the Fuel Type named by its column.
- A
- 17
When
dropna=Trueis used for the two-way table ofAutomaticand Fuel Type, which records contribute to the table?- A
Only records with missing values for both variables
- B
Records with a non-missing value for either
Automaticor Fuel Type - C
All records, with missing values counted as ordinary categories
- D
Records with non-missing values for both
Automaticand Fuel Type
Correct answer
DRecords with non-missing values for both
Automaticand Fuel TypeExplanation
A record is included only when both variables used in the cross-tabulation have non-missing values.
- A
- 18
What does a zero count for automatic cars with CNG fuel indicate in the observed cross-tabulation?
- A
Automatic cars with CNG fuel are impossible in every population
- B
No records in this data set have both an automatic gearbox and CNG fuel
- C
The CNG category was removed from the original data
- D
Every CNG car has a missing gearbox value
Correct answer
BNo records in this data set have both an automatic gearbox and CNG fuel
Explanation
The zero means that the observed data contain no records with both of those characteristics; it does not prove that such cars cannot exist elsewhere.
- A
- 19
What does a joint probability describe?
- A
The probability that either of two events occurs separately
- B
The count of records in a single category
- C
The probability that two specified events occur together
- D
The probability of one event after excluding all other events
Correct answer
CThe probability that two specified events occur together
Explanation
A joint probability represents the likelihood of two events occurring at the same time.
- A
- 20
How does the lecture convert cross-tabulated counts into joint probabilities?
- A
It sets
normalize=Trueinpd.crosstab - B
It sets
dropna=Falseinpd.crosstab - C
It sets
margins=Trueinpd.crosstab - D
It changes the
Automaticvalues from 0 and 1 to text
Correct answer
AIt sets
normalize=Trueinpd.crosstabExplanation
With
normalize=True, the table entries are proportions of the overall total, which the lecture interprets as joint probabilities. - A
- 21
In the joint-probability table, what does a cell for manual gearbox and CNG represent?
- A
The probability that a car uses CNG given that it has a manual gearbox
- B
The probability that a car has a manual gearbox given that it uses CNG
- C
The probability that a car has both a manual gearbox and CNG fuel
- D
The count of cars with either a manual gearbox or CNG fuel
Correct answer
CThe probability that a car has both a manual gearbox and CNG fuel
Explanation
A joint-probability cell gives the probability of the combination named by its row and column—in this case, both characteristics together.
- A
- 22
The joint probability for a manual gearbox and CNG fuel is reported as 0.01. What does this value mean?
- A
There are 0.01 cars with either a manual gearbox or CNG fuel
- B
About 1% of the observations have both a manual gearbox and CNG fuel
- C
About 1% of manual cars use CNG, conditional on being manual
- D
About 1% of CNG cars have a manual gearbox, conditional on using CNG
Correct answer
BAbout 1% of the observations have both a manual gearbox and CNG fuel
Explanation
An overall-normalized joint probability of 0.01 means that about 1% of all included observations have both characteristics.
- A
- 23
What is a marginal probability in a two-way table?
- A
The probability of one event considered by itself
- B
The probability that two events happen together
- C
The probability of one event given that another has occurred
- D
The count of observations with missing values in either variable
Correct answer
AThe probability of one event considered by itself
Explanation
A marginal probability concerns the occurrence of a single event, without conditioning on the other variable.
- A
- 24
What does adding
margins=Trueto the normalized cross-tabulation provide?- A
The conditional probabilities in every cell automatically
- B
Row and column totals, including marginal probabilities
- C
A separate correlation matrix for the variables
- D
Only the missing-value counts for each row
Correct answer
BRow and column totals, including marginal probabilities
Explanation
The margins setting adds row and column sums; when the table is normalized, these sums give marginal probabilities.
- A
- 25
In an overall-normalized table with gearbox type as rows, what does a row margin of approximately 0.947 for manual gearbox indicate?
- A
About 94.7% of the included cars have an automatic gearbox
- B
About 94.7% of petrol cars have a manual gearbox
- C
About 94.7% of the included cars have a manual gearbox
- D
About 94.7% of manual cars use petrol
Correct answer
CAbout 94.7% of the included cars have a manual gearbox
Explanation
A row margin is the probability of the row category regardless of Fuel Type, so this value represents the overall probability of a manual gearbox.
- A
- 26
In the same table, what does the petrol column margin of approximately 0.88 represent?
- A
The joint probability of petrol fuel and an automatic gearbox
- B
The probability that a manual car has petrol fuel
- C
The overall probability that a car has petrol fuel, regardless of gearbox type
- D
The probability that a petrol car has a manual gearbox
Correct answer
CThe overall probability that a car has petrol fuel, regardless of gearbox type
Explanation
A column margin gives the probability of that column category across all gearbox types; the petrol margin is the overall probability of petrol fuel.
- A
- 27
What should the sum of all joint probabilities in a complete normalized two-way table equal?
- A
The number of categories in the row variable
- B
1
- C
0
- D
The number of non-missing records
Correct answer
B1
Explanation
The joint probabilities cover all included combinations, so their total probability is 1.
- A
- 28
What does conditional probability express?
- A
The count of all events in a single variable
- B
The probability of an event given that another event has occurred
- C
The probability of two events occurring together without conditions
- D
The strength of association between two numerical variables
Correct answer
BThe probability of an event given that another event has occurred
Explanation
Conditional probability describes the probability of one event under the condition that another event has already occurred.
- A
- 29
What does
normalize='index'do in the gearbox-by-Fuel-Type table?- A
It adds row and column sums without changing the cell values
- B
It normalizes each row to sum to 1, giving Fuel Type probabilities conditional on gearbox type
- C
It normalizes each column to sum to 1, giving gearbox probabilities conditional on Fuel Type
- D
It normalizes the entire table to sum to 1, giving joint probabilities
Correct answer
BIt normalizes each row to sum to 1, giving Fuel Type probabilities conditional on gearbox type
Explanation
Index normalization makes each row sum to 1, so the entries describe the distribution of Fuel Type given the row's gearbox type.
- A
- 30
With
normalize='index', what does a value of 0.87 for petrol in the manual-gearbox row mean?- A
Among all cars, the probability of a manual gearbox is 0.87
- B
Among petrol cars, the probability of a manual gearbox is 0.87
- C
Among manual cars, the probability of petrol fuel is 0.87
- D
The overall probability of a car having both manual gearbox and petrol fuel is 0.87
Correct answer
CAmong manual cars, the probability of petrol fuel is 0.87
Explanation
Because rows are normalized, the value is conditional on the row category: given a manual gearbox, the probability of petrol fuel is 0.87.
- A
- 31
In the observed data, what does the petrol probability of 1 in the automatic-gearbox row imply?
- A
Every observed car with petrol fuel has an automatic gearbox
- B
Every observed petrol car has an automatic gearbox
- C
The overall probability of petrol fuel is 1
- D
Every observed automatic car has petrol fuel
Correct answer
DEvery observed automatic car has petrol fuel
Explanation
The automatic row sums to 1, and its petrol entry is 1, indicating that all observed automatic cars in the table use petrol.
- A
- 32
What does
normalize='columns'do in the gearbox-by-Fuel-Type table?- A
It makes each gearbox row sum to 1, giving Fuel Type probabilities conditional on gearbox
- B
It makes each Fuel Type column sum to 1, giving gearbox probabilities conditional on Fuel Type
- C
It replaces every column with its marginal count
- D
It makes the whole table sum to 1, giving joint probabilities
Correct answer
BIt makes each Fuel Type column sum to 1, giving gearbox probabilities conditional on Fuel Type
Explanation
Column normalization makes each column sum to 1, so each column describes gearbox probabilities given the Fuel Type named at its top.
- A
- 33
With column normalization, what does a value of 1 for manual gearbox in the CNG column indicate?
- A
Given that a car has a manual gearbox, its Fuel Type is CNG in all included records
- B
The joint probability of CNG and a manual gearbox is 1
- C
The overall probability of a manual gearbox is 1
- D
Given that a car uses CNG, its gearbox is manual in all included CNG records
Correct answer
DGiven that a car uses CNG, its gearbox is manual in all included CNG records
Explanation
The CNG column is normalized to 1, so the manual entry of 1 means all included CNG cars have a manual gearbox.
- A
- 34
What does a petrol-column value of 0.93 for manual gearbox mean under column normalization?
- A
Among manual cars, about 93% use petrol
- B
Among all cars, the probability of petrol fuel is 0.93
- C
Among petrol cars, about 93% have a manual gearbox
- D
About 93% of all cars are both petrol and manual
Correct answer
CAmong petrol cars, about 93% have a manual gearbox
Explanation
With columns normalized, the denominator is the number of petrol cars, so the value is the probability of a manual gearbox given petrol fuel.
- A
- 35
What kind of relationship is correlation used to assess in this lecture?
- A
The strength of association between two numerical variables
- B
The frequency of categories in a single categorical variable
- C
The number of records removed because of missing values
- D
The probability of two categorical events occurring together
Correct answer
AThe strength of association between two numerical variables
Explanation
The lecture introduces correlation as a measure of the strength of association between numerical variables.
- A
- 36
In a scatter plot, what pattern suggests a positive relationship between two variables?
- A
The points lie at the same value on both axes
- B
The points tend to fall as one variable increases
- C
The points tend to rise as one variable increases
- D
The points form no discernible pattern
Correct answer
CThe points tend to rise as one variable increases
Explanation
A positive trend means that larger values of one variable tend to occur with larger values of the other.
- A
- 37
A scatter plot shows points spread without a discernible pattern. What is the best interpretation given in the lecture?
- A
There is little or no correlation between the variables
- B
There is a strong positive correlation between the variables
- C
There is a strong negative correlation between the variables
- D
The variables must have identical values
Correct answer
AThere is little or no correlation between the variables
Explanation
The lecture associates a scattered pattern with little or no correlation between the two variables.
- A
- 38
What is the range of correlation values described in the lecture?
- A
From −1 to +1
- B
From 1 to +∞
- C
From 0 to +100
- D
From −100 to 0
Correct answer
AFrom −1 to +1
Explanation
Correlation values are bounded between −1 and +1.
- A
- 39
How should a correlation close to −1 be interpreted?
- A
No association between the variables
- B
A strong positive association between the variables
- C
A weak association that must be positive
- D
A strong negative association between the variables
Correct answer
DA strong negative association between the variables
Explanation
Values close to −1 indicate a strong negative relationship: as one variable increases, the other tends to decrease.
- A
- 40
How should a correlation close to +1 be interpreted?
- A
A relationship that is necessarily non-linear
- B
No association between the variables
- C
A strong negative association between the variables
- D
A strong positive association between the variables
Correct answer
DA strong positive association between the variables
Explanation
Values close to +1 indicate a strong positive relationship between the variables.
- A
- 41
According to the lecture, what does a correlation value of 0 represent?
- A
A correlation that is necessarily greater than 0.7
- B
No correlation between the two numerical variables
- C
A perfect positive correlation between the variables
- D
A perfect negative correlation between the variables
Correct answer
BNo correlation between the two numerical variables
Explanation
The lecture identifies 0 as indicating no correlation between the two numerical variables.
- A
- 42
The lecture describes a correlation above 0.7 as evidence of what?
- A
No correlation between the numerical variables
- B
A fair correlation between the numerical variables
- C
Proof that one variable causes the other
- D
A perfect negative correlation between the variables
Correct answer
BA fair correlation between the numerical variables
Explanation
The lecture states that a value above 0.7 can be considered a fair correlation; correlation alone does not establish causation.
- A
- 43
If a car's age increases while its price tends to decrease, what kind of correlation would represent this pattern?
- A
A zero correlation by definition
- B
A positive correlation
- C
A marginal probability
- D
A negative correlation
Correct answer
DA negative correlation
Explanation
When one variable tends to decrease as the other increases, their association is negative.
- A
- 44
Which correlation measure does the lecture identify as the default used by
DataFrame.corr?- A
Cross-tabulation correlation
- B
Marginal correlation
- C
Joint probability
- D
Pearson correlation
Correct answer
DPearson correlation
Explanation
The lecture states that Pearson correlation is used by default to assess association between numerical variables.
- A
- 45
Which alternatives does the lecture mention for assessing association involving ordinal variables?
- A
Index correlation and column correlation
- B
Joint probability and marginal probability
- C
Frequency correlation and conditional correlation
- D
Kendall rank correlation and Spearman rank correlation
Correct answer
DKendall rank correlation and Spearman rank correlation
Explanation
For ordinal variables, the lecture names Kendall rank correlation and Spearman rank correlation as alternative measures.
- A
- 46
What does the data frame
corrfunction calculate when applied to the numerical columns?- A
The joint probability of every pair of categories
- B
Pairwise correlations among the columns
- C
The number of missing values in each row
- D
A single frequency count for each column
Correct answer
BPairwise correlations among the columns
Explanation
The function computes pairwise correlations between columns, rather than only one selected pair.
- A
- 47
How does the lecture describe the handling of missing values during correlation calculation?
- A
All rows with any missing value are always converted to zeros
- B
Every null value is treated as a correlation of zero
- C
Null values are treated as a separate numerical category
- D
The pairwise calculation excludes null values
Correct answer
DThe pairwise calculation excludes null values
Explanation
The lecture notes that
correxcludes null values when computing the pairwise correlations. - A
- 48
Why does the lecture exclude object-type columns before calculating Pearson correlations?
- A
To ensure the correlation matrix includes only missing-value counts
- B
To retain numerical columns and omit categorical columns from the calculation
- C
To convert every numerical column into an object column
- D
To remove all rows that contain numerical values
Correct answer
BTo retain numerical columns and omit categorical columns from the calculation
Explanation
The analysis selects numerical columns by excluding object-type columns, because Pearson correlation is being used for numerical variables.
- A
- 49
The selected numerical data has shape (1436,8). What does this tell you?
- A
It contains 8 observations and 1,436 numerical variables
- B
It contains 1,436 correlation values and 8 rows
- C
It contains 1,436 missing values and 8 categorical variables
- D
It contains 1,436 observations and 8 numerical variables
Correct answer
DIt contains 1,436 observations and 8 numerical variables
Explanation
A data frame's shape lists its number of rows followed by its number of columns: 1,436 observations and 8 numerical variables.
- A
- 50
Why are all values on the principal diagonal of a correlation matrix equal to 1?
- A
Every pair of different variables has identical values
- B
Each variable has no missing observations
- C
Each variable is perfectly correlated with itself
- D
Each variable is independent of itself
Correct answer
CEach variable is perfectly correlated with itself
Explanation
The diagonal compares each variable with itself, and a variable has a correlation of 1 with itself.
- A
- 51
The reported correlation between car price and age is approximately −0.87. What does this suggest?
- A
A strong negative association: older cars tend to have lower prices
- B
A correlation that proves age directly causes price changes
- C
A strong positive association: older cars tend to have higher prices
- D
No association between car age and price
Correct answer
AA strong negative association: older cars tend to have lower prices
Explanation
The negative value, relatively close to −1, indicates a strong negative association; the lecture notes that price tends to decrease as car age increases.
- A
- 52
The reported correlation between price and kilometres travelled is approximately −0.57. Which interpretation matches the lecture?
- A
Price and kilometres have no relationship in the data
- B
Cars with more kilometres tend to have lower prices, with a fair negative association
- C
The value means that 57% of cars have missing kilometre values
- D
Cars with more kilometres tend to have higher prices, with a fair positive association
Correct answer
BCars with more kilometres tend to have lower prices, with a fair negative association
Explanation
The negative correlation indicates that price tends to decrease as kilometres increase; the lecture describes this as a fair negative relationship.
- A
- 53
The reported correlation between car weight and price is approximately +0.58. What does its sign indicate?
- A
Heavier cars tend to have higher prices
- B
Heavier cars tend to have lower prices
- C
Weight and price have no association
- D
The probability of a heavy car is 0.58
Correct answer
AHeavier cars tend to have higher prices
Explanation
A positive correlation indicates that the variables tend to increase together; the lecture describes price as increasing with car weight.
- A
- 54
The lecture reports a positive relationship between car age and kilometres travelled. What pattern does this describe?
- A
Older cars tend to have travelled fewer kilometres
- B
Cars with more kilometres must have lower weight
- C
Older cars tend to have travelled more kilometres
- D
Car age and kilometres are unrelated in the observed data
Correct answer
COlder cars tend to have travelled more kilometres
Explanation
The lecture interprets the positive age–kilometres relationship to mean that older cars tend to have accumulated more kilometres.
- A
- 55
How can a user request a correlation measure other than Pearson in the lecture's Python workflow?
- A
By adding
margins=Trueto a cross-tabulation - B
By changing the data frame's working directory
- C
By setting
index_col=0while reading the file - D
By specifying a different method argument
Correct answer
DBy specifying a different method argument
Explanation
The lecture explains that another correlation measure can be chosen by specifying it through the
methodargument. - A

Ask anything
We've read this whole study set, so questions about it get the best answers.