Pandas for Data Analysis
- 69Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
In the English-word DataFrame, what does it mean that the word itself is the index?
In the English-word DataFrame, what does it mean that the word itself is the index?
69 questions
- 1
In the English-word DataFrame, what does it mean that the word itself is the index?
- A
A word is stored only as a value in the character-count column
- B
The word determines the order in which columns are displayed
- C
Each word is automatically converted into a numerical row position
- D
A word can be used as a row label to look up its data
Correct answer
DA word can be used as a row label to look up its data
Explanation
The words serve as index labels, so a particular word can be selected by its label.
- A
- 2
Which pandas method is used in the examples to select a row by its index label?
- A
.loc - B
.value_counts - C
.iloc - D
.describe
Correct answer
A.locExplanation
The examples use
.locfor label-based selection, including when the index consists of words. - A
- 3
How can
.locbe used to retrieve several rows whose labels are known?- A
Convert the labels to row numbers before selecting
- B
Pass the labels as a column-selection argument
- C
Call
.loconce for each column in the DataFrame - D
Pass a list of labels as the row-selection argument
Correct answer
DPass a list of labels as the row-selection argument
Explanation
.locaccepts a list of index labels, which selects multiple matching rows. - A
- 4
What does the second argument to
.locspecify when selecting both rows and columns?- A
The sorting order for the selected rows
- B
The number of rows to skip before selecting
- C
The data type to assign to the selected rows
- D
The columns to return for the selected rows
Correct answer
DThe columns to return for the selected rows
Explanation
The first
.locargument selects index labels; the second selects columns. - A
- 5
When
.locselects a single row from the word DataFrame, how is that row represented in the described result?- A
As a Python tuple
- B
As a Series
- C
As a Boolean array
- D
As a one-column DataFrame in every case
Correct answer
BAs a Series
Explanation
The example explains that a selected row is represented as a Series.
- A
- 6
What information does a DataFrame's
shapeprovide?- A
The number of rows and columns
- B
The names of all index labels
- C
The number of missing values in each column
- D
The maximum value in each numeric column
Correct answer
AThe number of rows and columns
Explanation
The
shapeproperty reports the DataFrame's dimensions: its rows and columns. - A
- 7
In the word dataset, how is the character-count column defined?
- A
It is the index position of each word
- B
It is the number of distinct characters in each word
- C
It is the length of each word
- D
It is the sum of the character values in each word
Correct answer
CIt is the length of each word
Explanation
The character count is defined as the length of the word.
- A
- 8
If each letter is assigned its alphabetical position, how is a word's value calculated?
- A
By adding the values of its individual characters
- B
By taking the position of its first character
- C
By multiplying the values of its individual characters
- D
By counting how many times each character appears
Correct answer
ABy adding the values of its individual characters
Explanation
The word value is computed by summing the individual values assigned to its characters.
- A
- 9
How can a new column representing value per character be created from
valueandchar_count?- A
Divide
valuebychar_countfor each row - B
Divide
char_countby the number of DataFrame rows - C
Multiply
valuebychar_countfor each row - D
Add
valuetochar_countfor each row
Correct answer
ADivide
valuebychar_countfor each rowExplanation
The ratio column is defined as each word's value divided by its character count.
- A
- 10
What is the purpose of a Boolean mask in pandas row selection?
- A
It sorts rows according to whether their values are numeric
- B
It indicates which rows meet a condition and should be selected
- C
It replaces missing values with true or false
- D
It converts every selected row into a column label
Correct answer
BIt indicates which rows meet a condition and should be selected
Explanation
A Boolean mask has true or false values corresponding to rows; true entries identify rows to retain.
- A
- 11
What does summing a Boolean condition such as
column > thresholdcount in the example?- A
The sum of the original numeric column
- B
The number of rows for which the condition is false
- C
The number of rows for which the condition is true
- D
The number of distinct values in the column
Correct answer
CThe number of rows for which the condition is true
Explanation
Boolean true values contribute one and false values contribute zero, so their sum counts matching rows.
- A
- 12
Which operator combines two pandas Boolean conditions so that both must be true?
- A
& - B
~ - C
| - D
+
Correct answer
A&Explanation
The ampersand combines elementwise conditions with AND semantics; both conditions must be true for a row to match.
- A
- 13
Which operator combines two Boolean conditions so that either one may be true?
- A
| - B
~ - C
& - D
/
Correct answer
A|Explanation
The pipe operator combines conditions with OR semantics, retaining rows that satisfy either condition.
- A
- 14
Why should parentheses be used around individual conditions when combining them with pandas Boolean operators?
- A
They convert string comparisons into numeric comparisons
- B
They prevent Boolean results from being stored in memory
- C
They make the intended order of Boolean operations explicit
- D
They make each condition apply to a separate DataFrame column
Correct answer
CThey make the intended order of Boolean operations explicit
Explanation
Parentheses clarify and control which parts of a combined condition are evaluated together, especially when mixing AND and OR.
- A
- 15
In a
.queryexpression, how should a column name containing spaces be referenced?- A
Replace every space with an underscore in the expression
- B
Surround the column name with quotation marks
- C
Surround the column name with backticks
- D
Prefix the column name with an at sign
Correct answer
CSurround the column name with backticks
Explanation
The query examples use backticks around column names that contain spaces.
- A
- 16
How does a
.queryexpression refer to a variable defined outside the query?- A
Put the variable name in the column list
- B
Prefix the variable name with
@ - C
Prefix the variable name with
& - D
Surround the variable name with backticks
Correct answer
BPrefix the variable name with
@Explanation
The at sign, as in
@variable, tells.queryto use an external variable rather than interpret the name as a column. - A
- 17
What is a direct way to select rows from a Boolean column that is already true for the desired records?
- A
Sort the Boolean column and select its last row
- B
Use the Boolean column as the DataFrame's column list
- C
Pass the Boolean column as the row-selection mask
- D
Convert the Boolean column to strings and use
.describe
Correct answer
CPass the Boolean column as the row-selection mask
Explanation
A Boolean column can itself act as the mask for selecting matching rows, as with the legendary-status column.
- A
- 18
What does negating a Boolean mask do to its entries?
- A
It switches true values to false and false values to true
- B
It sorts the mask in descending order
- C
It removes the rows whose values are numeric
- D
It changes every true value to a missing value
Correct answer
AIt switches true values to false and false values to true
Explanation
Negation inverts a Boolean mask, making it useful for selecting rows that do not satisfy the original condition.
- A
- 19
How can
.isinsimplify a condition that checks whether a column belongs to one of several values?- A
It converts the collection into a Boolean column automatically
- B
It tests whether each value equals the entire collection
- C
It sorts the column into the order of the supplied collection
- D
It tests whether each value belongs to a supplied collection
Correct answer
DIt tests whether each value belongs to a supplied collection
Explanation
.isinchecks membership in a collection and can replace a chain of OR comparisons for allowed values. - A
- 20
If a Pokémon must be both a Fire primary type and a Flying secondary type, what kind of condition is needed?
- A
An OR combination of the two type conditions
- B
A membership test on the speed column
- C
An AND combination of the two type conditions
- D
A negation of the primary-type condition
Correct answer
CAn AND combination of the two type conditions
Explanation
The Pokémon must meet both stated conditions, so the type comparisons are combined with AND.
- A
- 21
Which method gives the maximum of one selected numeric column?
- A
Sort the index and call
.info() - B
Select the column and call
.max() - C
Call
.shapeon the column - D
Call
.value_counts()on the whole DataFrame
Correct answer
BSelect the column and call
.max()Explanation
Selecting a numeric column and calling
.max()returns that column's maximum. - A
- 22
What does calling
.describe()on a DataFrame of numeric columns provide?- A
A Boolean mask identifying outliers
- B
Summary statistics such as count, mean, minimum, and maximum
- C
The frequency of every distinct value in every column
- D
A list of all rows sorted by their index labels
Correct answer
BSummary statistics such as count, mean, minimum, and maximum
Explanation
.describe()provides summary statistics for numeric columns, including measures such as mean, minimum, and maximum. - A
- 23
What does the mode of a numeric column identify?
- A
The largest value in the column
- B
The value that occurs most frequently
- C
The average of all values
- D
The value halfway between the minimum and maximum
Correct answer
BThe value that occurs most frequently
Explanation
The mode is the most frequently occurring value.
- A
- 24
What additional information does
.value_counts()provide beyond simply identifying a column's mode?- A
A frequency count for each distinct value
- B
The average and standard deviation for each value
- C
The number of columns that contain each value
- D
The index label of the maximum value only
Correct answer
AA frequency count for each distinct value
Explanation
.value_counts()ranks distinct values by frequency and reports how many times each appears. - A
- 25
How can the highest value appear first after sorting a column in pandas?
- A
Sort the index with
ascending=False - B
Sort by that column with
ascending=False - C
Sort by that column with
ascending=True - D
Apply
.describe()before sorting
Correct answer
BSort by that column with
ascending=FalseExplanation
Descending sorting places higher values before lower ones, which is specified with
ascending=False. - A
- 26
What does sorting by multiple columns allow you to do?
- A
Calculate a separate average for each column
- B
Filter out rows that fail either column's condition
- C
Use one column as the primary sort and another as a further ordering criterion
- D
Replace missing values based on both columns
Correct answer
CUse one column as the primary sort and another as a further ordering criterion
Explanation
Multiple sort columns provide successive ordering criteria, such as sorting first by defense and then by attack.
- A
- 27
After filtering to rows with a target value, how can the shortest matching word be found?
- A
Sort the original index and choose the first row
- B
Take the maximum value of the value column
- C
Count the occurrences of each character count
- D
Sort the remaining rows by character count or take the minimum character count
Correct answer
DSort the remaining rows by character count or take the minimum character count
Explanation
Once the rows are filtered, the shortest word can be found by ordering character counts or computing their minimum.
- A
- 28
Why might
.value_counts()be inconvenient for searching a continuous ratio column?- A
It can only operate on columns containing strings
- B
Many distinct ratio values may make the frequency output unwieldy
- C
It automatically drops rows whose ratios are equal
- D
It replaces the ratio values with their averages
Correct answer
BMany distinct ratio values may make the frequency output unwieldy
Explanation
A continuous column may have many distinct values, making a frequency listing less useful than a direct condition such as ratio equals a target.
- A
- 29
Why can a histogram or box plot be useful early in data analysis?
- A
It guarantees that every column has the correct data type
- B
It automatically corrects all missing values
- C
It gives a quick view of distributions, ranges, and possible unusual values
- D
It identifies the exact cause of every data-quality issue
Correct answer
CIt gives a quick view of distributions, ranges, and possible unusual values
Explanation
Visualizations can quickly reveal distributions, ranges, and potential outliers, helping guide later analysis.
- A
- 30
What does setting invalid rating values to
NaNaccomplish in the app-data example?- A
It converts every rating into a string
- B
It marks values outside the valid rating range as missing
- C
It removes every app with a rating
- D
It replaces all valid ratings with the column mean
Correct answer
BIt marks values outside the valid rating range as missing
Explanation
Ratings above the valid maximum were treated as invalid and replaced with
NaNso they could be handled as missing values. - A
- 31
How were missing or invalid rating values filled in the example?
- A
With the mean of the rating column
- B
With the maximum value of the rating column
- C
With the string
unknown - D
With the most frequent app category
Correct answer
AWith the mean of the rating column
Explanation
The example fills null rating values using the rating column's mean.
- A
- 32
Why did the reviews column remain an object rather than being parsed as numeric?
- A
The column contained only missing values
- B
Some entries contained nonnumeric text, such as a suffix for millions
- C
Pandas stores every count column as an object
- D
The reviews column was used as the DataFrame index
Correct answer
BSome entries contained nonnumeric text, such as a suffix for millions
Explanation
Entries with text such as
Mprevented pandas from parsing the entire reviews column as numeric. - A
- 33
What is the purpose of using numeric conversion with
errors='coerce'when checking a suspicious column?- A
Valid numeric values become strings for safe storage
- B
Every row that contains a string is immediately deleted
- C
Unparseable entries become missing values instead of stopping the conversion
- D
All strings are converted to zero without inspection
Correct answer
CUnparseable entries become missing values instead of stopping the conversion
Explanation
With coercion, values that cannot be parsed as numbers become
NaN, helping identify problematic entries. - A
- 34
How were review counts with an
Msuffix handled before converting them to numbers?- A
Remove the suffix, convert the remaining text, then multiply by one million
- B
Replace the suffix with a comma, then divide by one thousand
- C
Keep the suffix and ask
.describe()to parse it - D
Delete every row containing the suffix
Correct answer
ARemove the suffix, convert the remaining text, then multiply by one million
Explanation
The example removes
M, converts the remaining value to numeric, and multiplies by one million to restore the intended count. - A
- 35
What does checking duplicates on a subset containing only the app-name column detect?
- A
Rows with the same review count but different app names
- B
Rows sharing an app name, even if other columns differ
- C
Rows identical in every column only
- D
Rows that have any missing value
Correct answer
BRows sharing an app name, even if other columns differ
Explanation
Specifying the app column as the duplicate-check subset detects repeated app names regardless of differences in other columns.
- A
- 36
What is the effect of setting
keep=Falsewhen identifying duplicates?- A
Only the last occurrence is marked as duplicated
- B
Every occurrence of a duplicated value is marked as duplicated
- C
Only the first occurrence is marked as duplicated
- D
No occurrence is marked unless every column matches
Correct answer
BEvery occurrence of a duplicated value is marked as duplicated
Explanation
With
keep=False, all rows belonging to a duplicate group are marked, rather than preserving one occurrence as the original. - A
- 37
Why sort app records by review count before dropping duplicates while keeping the last row?
- A
To ensure duplicate names become unique strings
- B
To retain the duplicate record with the greatest review count
- C
To place missing review counts at the top of the DataFrame
- D
To retain the duplicate record with the fewest review count
Correct answer
BTo retain the duplicate record with the greatest review count
Explanation
Sorting by reviews and keeping the last duplicate retains the record with the largest review count, treated in the example as the freshest scrape.
- A
- 38
How can category labels such as
AUTO_PARTSbe formatted as ordinary title-like text?- A
Convert the category to a numeric value
- B
Sort the category values and select the first
- C
Replace underscores with spaces and capitalize the result
- D
Remove all letters after the underscore
Correct answer
CReplace underscores with spaces and capitalize the result
Explanation
The example replaces underscores with spaces and capitalizes the category text.
- A
- 39
What cleaning steps were used to convert install counts containing commas and plus signs?
- A
Convert the values to dates, then remove the commas
- B
Replace every digit with a plus sign, then call
.value_counts() - C
Remove the commas and plus signs, then convert the values to numeric
- D
Drop every row whose install count contains punctuation
Correct answer
CRemove the commas and plus signs, then convert the values to numeric
Explanation
Removing formatting characters such as commas and plus signs allows the install values to be converted to numeric form.
- A
- 40
How should a size such as a value in kilobytes be converted to bytes, according to the example?
- A
Remove the unit suffix, convert the number, and multiply by 1024
- B
Remove the unit suffix, convert the number, and divide by 1024
- C
Replace the unit suffix with a decimal point
- D
Add 1024 to the text before converting it
Correct answer
ARemove the unit suffix, convert the number, and multiply by 1024
Explanation
The example converts kilobytes to bytes by multiplying the numeric value by 1024; megabytes require multiplying by 1024 twice.
- A
- 41
Why can keeping a copy of a DataFrame be useful during a cleaning workflow?
- A
It prevents pandas from changing column data types
- B
It ensures that later sorting operations are faster
- C
It automatically validates every cleaning rule
- D
It allows recovery of an earlier state if a modification causes a problem
Correct answer
DIt allows recovery of an earlier state if a modification causes a problem
Explanation
A saved copy provides a way to return to the earlier data if subsequent changes or cleaning steps go wrong.
- A
- 42
Why does domain knowledge matter when deciding whether data values are valid?
- A
It guarantees that outliers are measurement errors
- B
It removes the need to inspect data types
- C
It lets pandas infer every missing value without rules
- D
It helps determine realistic meanings, ranges, and constraints for the data
Correct answer
DIt helps determine realistic meanings, ranges, and constraints for the data
Explanation
Knowing the domain helps distinguish valid values from impossible or suspicious ones, such as an invalid score or rating.
- A
- 43
What is the basic purpose of a pandas
groupbyoperation?- A
Split records into groups, apply calculations, and combine the results
- B
Convert every column to a categorical type
- C
Merge two DataFrames using their index values
- D
Sort all rows by every column and remove duplicates
Correct answer
ASplit records into groups, apply calculations, and combine the results
Explanation
The described groupby process is split-apply-combine: form groups, perform an operation, and assemble the results.
- A
- 44
To calculate total home goals by team, which grouping and aggregation are appropriate?
- A
Group by home team and sum home goals
- B
Group by season and take the maximum away goals
- C
Group by away team and average home goals
- D
Group by result and count home teams
Correct answer
AGroup by home team and sum home goals
Explanation
The total scored at home by each team is found by grouping on the home-team column and summing home goals.
- A
- 45
How can the average number of goals per match be calculated when home and away goals are separate?
- A
Count the unique values in both goal columns
- B
Add home and away goals for each match, then take the mean
- C
Group by the result and take the minimum of each column
- D
Subtract away goals from home goals, then take the maximum
Correct answer
BAdd home and away goals for each match, then take the mean
Explanation
Total goals per match are the home goals plus away goals; averaging those totals gives average goals per match.
- A
- 46
Why might the absolute value be used when finding the largest goal difference regardless of which side won?
- A
It identifies which team was the home team
- B
It removes matches with equal scores
- C
It compares the magnitude of the difference without regard to its sign
- D
It converts the goal counts into percentages
Correct answer
CIt compares the magnitude of the difference without regard to its sign
Explanation
A signed difference can be positive or negative depending on the winner; the absolute value captures the size of the margin either way.
- A
- 47
When counting a team's away wins, what should be counted within each away-team group?
- A
The number of distinct home-team names
- B
The total number of goals scored at home
- C
Rows whose result indicates a home win
- D
Rows whose result indicates an away win
Correct answer
DRows whose result indicates an away win
Explanation
The count sought is away victories, so each away-team group must count the records whose result is an away win.
- A
- 48
When aggregating goals received at home by each team, which goal column should be summed?
- A
The difference between home and away goals
- B
Away goals
- C
Home goals
- D
Total goals scored by the home team
Correct answer
BAway goals
Explanation
When a team is the home team, the opponent's goals are recorded in the away-goals column, so summing away goals gives goals received.
- A
- 49
Why should goals received be compared per home match rather than only by the total?
- A
Home goals and away goals always have identical totals
- B
Teams may have played different numbers of home matches
- C
A total cannot be calculated from numeric columns
- D
The result column stores the number of matches played
Correct answer
BTeams may have played different numbers of home matches
Explanation
A per-match rate accounts for teams having played different numbers of games; the example computes goals received divided by home games.
- A
- 50
What does
groupby(...).transform('max')do differently from a simple groupby maximum aggregation?- A
It replaces the grouping column with the maximum
- B
It broadcasts each group's maximum back to the rows in that group
- C
It returns only one row for each group
- D
It sorts each group by its maximum value
Correct answer
BIt broadcasts each group's maximum back to the rows in that group
Explanation
The transform operation returns results aligned with the original rows, repeating a group's maximum for each member of that group.
- A
- 51
How can a player who scored the most points on their team be selected after adding each team's maximum points to every row?
- A
Group by player and count the number of teams
- B
Sort the team names alphabetically and select the first row
- C
Keep rows where the player's points equal the broadcast team maximum
- D
Keep rows whose points are below the team maximum
Correct answer
CKeep rows where the player's points equal the broadcast team maximum
Explanation
Comparing each player's points with the transformed team maximum identifies the top scorer or scorers for that team.
- A
- 52
How can the most frequent primary type among legendary Pokémon be found?
- A
Count the number of columns in the filtered DataFrame
- B
Group by secondary type and take its mean
- C
Sort all Pokémon by speed and take the last row
- D
Filter to legendary Pokémon, select primary type, then use
.value_counts()
Correct answer
DFilter to legendary Pokémon, select primary type, then use
.value_counts()Explanation
Filtering first restricts the data to legendary Pokémon; value counts on the primary-type column ranks their types by frequency.
- A
- 53
What is the role of a Cartesian product when comparing company names from two datasets?
- A
It creates every possible pairing of a name from the first dataset with one from the second
- B
It removes repeated company names from both datasets
- C
It sorts each dataset independently by company name
- D
It matches only names that are already identical
Correct answer
AIt creates every possible pairing of a name from the first dataset with one from the second
Explanation
The product pairs every first-dataset company with every second-dataset company so their similarity can be evaluated.
- A
- 54
Why can representing company comparisons as a DataFrame be more useful than only using nested loops?
- A
It reduces the number of possible company pairs to identical names
- B
It guarantees that every similarity score is correct
- C
It makes comparisons available for filtering, sorting, and visual analysis
- D
It avoids calculating any similarity scores
Correct answer
CIt makes comparisons available for filtering, sorting, and visual analysis
Explanation
A tabular representation of pairs and scores supports exploratory analysis such as sorting, filtering, and plotting.
- A
- 55
What does a fuzzy string-similarity score help estimate?
- A
How many characters are in the longer string only
- B
How many times a string appears in a DataFrame
- C
How similar two strings are despite differences in their spelling or formatting
- D
Whether two numeric columns have the same mean
Correct answer
CHow similar two strings are despite differences in their spelling or formatting
Explanation
The described fuzzy matching methods return a score indicating similarity between two company-name strings.
- A
- 56
Why was a partial string ratio useful for matching company names in the example?
- A
It ignores all spaces and punctuation by deleting the names
- B
It converts company names into numerical identifiers
- C
It requires the complete strings to be exactly equal
- D
It can identify matching portions even when one name contains additional words
Correct answer
DIt can identify matching portions even when one name contains additional words
Explanation
Partial matching can score names highly when a shared company name appears alongside additional text in one string.
- A
- 57
What is an important limitation of using a fixed similarity-score cutoff for company matching?
- A
A high-scoring pair may still represent different entities
- B
A score cutoff makes string data impossible to sort
- C
Every score above the cutoff is guaranteed to be a true match
- D
The cutoff automatically accounts for business context
Correct answer
AA high-scoring pair may still represent different entities
Explanation
The example shows that unrelated entities can share common words and receive a high score, so results need contextual review.
- A
- 58
Why is domain knowledge especially valuable after fuzzy matching produces plausible company pairs?
- A
It ensures the product contains fewer pairs
- B
It converts each company name into a valid date
- C
It increases the computed similarity score automatically
- D
It helps decide whether similar names refer to the same real-world entity
Correct answer
DIt helps decide whether similar names refer to the same real-world entity
Explanation
Similarity scores are heuristics; understanding the entities and business context helps decide whether a proposed match is genuine.
- A
- 59
In the birthday-pair method, what does generating combinations of two players allow you to check?
- A
Whether every player has a unique birthday
- B
Whether players belong to the same team in different seasons
- C
Whether each birthday occurs in the same year
- D
Whether the birthdays of each distinct pair match
Correct answer
DWhether the birthdays of each distinct pair match
Explanation
Pairwise combinations create the pairs whose birthday values can be compared for equality.
- A
- 60
Why are there more possible pairs when another person joins a group?
- A
The new person can only pair with the first person
- B
The new person forms a pair with each person already in the group
- C
The number of pairs increases by exactly one
- D
The new person duplicates every existing pair
Correct answer
BThe new person forms a pair with each person already in the group
Explanation
Each new person creates one new pair with every person already present, so the number of pairs grows with the group size.
- A
- 61
What counterintuitive result about the birthday problem is stated in the content?
- A
More than 300 people are needed for a chance above 50%
- B
Two people always share a birthday in any group of 23
- C
A group of 23 people is enough for the chance of a shared birthday to exceed 50%
- D
A group of 23 people guarantees that everyone has a different birthday
Correct answer
CA group of 23 people is enough for the chance of a shared birthday to exceed 50%
Explanation
The birthday paradox states that only 23 people are needed for the probability of at least one shared birthday to exceed 50%; it is not a guarantee.
- A
- 62
Why can the year be omitted when comparing birthdays for a shared-birthday question?
- A
The year is needed only when sorting names
- B
The year determines the number of player pairs
- C
The year is always the same for every player
- D
The comparison concerns month and day, even if the birth years differ
Correct answer
DThe comparison concerns month and day, even if the birth years differ
Explanation
The example defines a shared birthday by the same month and day, regardless of whether the birth years match.
- A
- 63
What is the purpose of formatting a birth-date column to month and day before matching birthdays?
- A
It sorts the players by their age automatically
- B
It makes every date unique across the dataset
- C
It creates comparable values that ignore the birth year
- D
It converts each birthday into a team identifier
Correct answer
CIt creates comparable values that ignore the birth year
Explanation
Extracting month and day lets the analysis compare birthdays without treating different birth years as different birthdays.
- A
- 64
What does a left merge preserve when the season statistics DataFrame is on the left?
- A
All rows from the season statistics, with matching player details added where available
- B
Only rows that match in both DataFrames
- C
Only rows whose player details contain no missing values
- D
All rows from the player-details DataFrame and no unmatched season rows
Correct answer
AAll rows from the season statistics, with matching player details added where available
Explanation
A left merge retains all rows from the left DataFrame and brings in matching information from the right DataFrame.
- A
- 65
If a player name is missing after a left merge, what does that indicate in the described example?
- A
The player's college value was missing
- B
The player necessarily had no NBA statistics
- C
The merge did not find a matching player record for that row
- D
The left DataFrame contained no rows
Correct answer
CThe merge did not find a matching player record for that row
Explanation
The player name should be present in the matched player-details data, so a missing name signals an unmatched row.
- A
- 66
How can a merge use different key-column names in the two DataFrames?
- A
Specify the left key and right key separately
- B
Rename both DataFrames to the same variable name
- C
Convert both keys to index positions and use
.shape - D
Drop one key and merge on every remaining column
Correct answer
ASpecify the left key and right key separately
Explanation
The merge example specifies the player column on the left and the name column on the right as corresponding keys.
- A
- 67
Why did some NBA player rows fail to match even though the player existed in the details data?
- A
The left merge removed every player with a birthday
- B
The player had a numeric team name instead of a string
- C
The player's name had changed or was represented differently between datasets
- D
The season statistics contained no player-name column
Correct answer
CThe player's name had changed or was represented differently between datasets
Explanation
The investigation found differences in player-name representations, so correcting those names allowed the rows to match.
- A
- 68
What does converting a birth-date column with
to_datetimeenable?- A
Conversion of team labels into numeric codes
- B
Automatic matching of names across DataFrames
- C
Date-aware operations, such as calculating time differences or means
- D
Automatic removal of duplicate players
Correct answer
CDate-aware operations, such as calculating time differences or means
Explanation
A datetime column supports date calculations, including time differences and operations such as computing an average date.
- A
- 69
In the youngest-team comparison, why does the team with the latest average birth date have the youngest squad?
- A
A more recent birth date corresponds to a younger age
- B
The average birth date is the team's most frequent birthday
- C
A later birth date indicates a lower player count
- D
A later date always means a larger number of games played
Correct answer
AA more recent birth date corresponds to a younger age
Explanation
For players evaluated at the same reference time, more recent birth dates correspond to younger ages.
- A

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