1. Home
  2. Explore
  3. Computer Science
  4. Pandas for Data Analysis

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Pandas for Data Analysis

  • 69Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: DataFrame Indexing

In the English-word DataFrame, what does it mean that the word itself is the index?

69 questions

  1. 1

    In the English-word DataFrame, what does it mean that the word itself is the index?

    1. A

      A word is stored only as a value in the character-count column

    2. B

      The word determines the order in which columns are displayed

    3. C

      Each word is automatically converted into a numerical row position

    4. D

      A word can be used as a row label to look up its data

    Correct answer
    D

    A 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.

  2. 2

    Which pandas method is used in the examples to select a row by its index label?

    1. A

      .loc

    2. B

      .value_counts

    3. C

      .iloc

    4. D

      .describe

    Correct answer
    A

    .loc

    Explanation

    The examples use .loc for label-based selection, including when the index consists of words.

  3. 3

    How can .loc be used to retrieve several rows whose labels are known?

    1. A

      Convert the labels to row numbers before selecting

    2. B

      Pass the labels as a column-selection argument

    3. C

      Call .loc once for each column in the DataFrame

    4. D

      Pass a list of labels as the row-selection argument

    Correct answer
    D

    Pass a list of labels as the row-selection argument

    Explanation

    .loc accepts a list of index labels, which selects multiple matching rows.

  4. 4

    What does the second argument to .loc specify when selecting both rows and columns?

    1. A

      The sorting order for the selected rows

    2. B

      The number of rows to skip before selecting

    3. C

      The data type to assign to the selected rows

    4. D

      The columns to return for the selected rows

    Correct answer
    D

    The columns to return for the selected rows

    Explanation

    The first .loc argument selects index labels; the second selects columns.

  5. 5

    When .loc selects a single row from the word DataFrame, how is that row represented in the described result?

    1. A

      As a Python tuple

    2. B

      As a Series

    3. C

      As a Boolean array

    4. D

      As a one-column DataFrame in every case

    Correct answer
    B

    As a Series

    Explanation

    The example explains that a selected row is represented as a Series.

  6. 6

    What information does a DataFrame's shape provide?

    1. A

      The number of rows and columns

    2. B

      The names of all index labels

    3. C

      The number of missing values in each column

    4. D

      The maximum value in each numeric column

    Correct answer
    A

    The number of rows and columns

    Explanation

    The shape property reports the DataFrame's dimensions: its rows and columns.

  7. 7

    In the word dataset, how is the character-count column defined?

    1. A

      It is the index position of each word

    2. B

      It is the number of distinct characters in each word

    3. C

      It is the length of each word

    4. D

      It is the sum of the character values in each word

    Correct answer
    C

    It is the length of each word

    Explanation

    The character count is defined as the length of the word.

  8. 8

    If each letter is assigned its alphabetical position, how is a word's value calculated?

    1. A

      By adding the values of its individual characters

    2. B

      By taking the position of its first character

    3. C

      By multiplying the values of its individual characters

    4. D

      By counting how many times each character appears

    Correct answer
    A

    By adding the values of its individual characters

    Explanation

    The word value is computed by summing the individual values assigned to its characters.

  9. 9

    How can a new column representing value per character be created from value and char_count?

    1. A

      Divide value by char_count for each row

    2. B

      Divide char_count by the number of DataFrame rows

    3. C

      Multiply value by char_count for each row

    4. D

      Add value to char_count for each row

    Correct answer
    A

    Divide value by char_count for each row

    Explanation

    The ratio column is defined as each word's value divided by its character count.

  10. 10

    What is the purpose of a Boolean mask in pandas row selection?

    1. A

      It sorts rows according to whether their values are numeric

    2. B

      It indicates which rows meet a condition and should be selected

    3. C

      It replaces missing values with true or false

    4. D

      It converts every selected row into a column label

    Correct answer
    B

    It 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.

  11. 11

    What does summing a Boolean condition such as column > threshold count in the example?

    1. A

      The sum of the original numeric column

    2. B

      The number of rows for which the condition is false

    3. C

      The number of rows for which the condition is true

    4. D

      The number of distinct values in the column

    Correct answer
    C

    The 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.

  12. 12

    Which operator combines two pandas Boolean conditions so that both must be true?

    1. A

      &

    2. B

      ~

    3. C

      |

    4. D

      +

    Correct answer
    A

    &

    Explanation

    The ampersand combines elementwise conditions with AND semantics; both conditions must be true for a row to match.

  13. 13

    Which operator combines two Boolean conditions so that either one may be true?

    1. A

      |

    2. B

      ~

    3. C

      &

    4. D

      /

    Correct answer
    A

    |

    Explanation

    The pipe operator combines conditions with OR semantics, retaining rows that satisfy either condition.

  14. 14

    Why should parentheses be used around individual conditions when combining them with pandas Boolean operators?

    1. A

      They convert string comparisons into numeric comparisons

    2. B

      They prevent Boolean results from being stored in memory

    3. C

      They make the intended order of Boolean operations explicit

    4. D

      They make each condition apply to a separate DataFrame column

    Correct answer
    C

    They 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.

  15. 15

    In a .query expression, how should a column name containing spaces be referenced?

    1. A

      Replace every space with an underscore in the expression

    2. B

      Surround the column name with quotation marks

    3. C

      Surround the column name with backticks

    4. D

      Prefix the column name with an at sign

    Correct answer
    C

    Surround the column name with backticks

    Explanation

    The query examples use backticks around column names that contain spaces.

  16. 16

    How does a .query expression refer to a variable defined outside the query?

    1. A

      Put the variable name in the column list

    2. B

      Prefix the variable name with @

    3. C

      Prefix the variable name with &

    4. D

      Surround the variable name with backticks

    Correct answer
    B

    Prefix the variable name with @

    Explanation

    The at sign, as in @variable, tells .query to use an external variable rather than interpret the name as a column.

  17. 17

    What is a direct way to select rows from a Boolean column that is already true for the desired records?

    1. A

      Sort the Boolean column and select its last row

    2. B

      Use the Boolean column as the DataFrame's column list

    3. C

      Pass the Boolean column as the row-selection mask

    4. D

      Convert the Boolean column to strings and use .describe

    Correct answer
    C

    Pass 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.

  18. 18

    What does negating a Boolean mask do to its entries?

    1. A

      It switches true values to false and false values to true

    2. B

      It sorts the mask in descending order

    3. C

      It removes the rows whose values are numeric

    4. D

      It changes every true value to a missing value

    Correct answer
    A

    It 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.

  19. 19

    How can .isin simplify a condition that checks whether a column belongs to one of several values?

    1. A

      It converts the collection into a Boolean column automatically

    2. B

      It tests whether each value equals the entire collection

    3. C

      It sorts the column into the order of the supplied collection

    4. D

      It tests whether each value belongs to a supplied collection

    Correct answer
    D

    It tests whether each value belongs to a supplied collection

    Explanation

    .isin checks membership in a collection and can replace a chain of OR comparisons for allowed values.

  20. 20

    If a Pokémon must be both a Fire primary type and a Flying secondary type, what kind of condition is needed?

    1. A

      An OR combination of the two type conditions

    2. B

      A membership test on the speed column

    3. C

      An AND combination of the two type conditions

    4. D

      A negation of the primary-type condition

    Correct answer
    C

    An AND combination of the two type conditions

    Explanation

    The Pokémon must meet both stated conditions, so the type comparisons are combined with AND.

  21. 21

    Which method gives the maximum of one selected numeric column?

    1. A

      Sort the index and call .info()

    2. B

      Select the column and call .max()

    3. C

      Call .shape on the column

    4. D

      Call .value_counts() on the whole DataFrame

    Correct answer
    B

    Select the column and call .max()

    Explanation

    Selecting a numeric column and calling .max() returns that column's maximum.

  22. 22

    What does calling .describe() on a DataFrame of numeric columns provide?

    1. A

      A Boolean mask identifying outliers

    2. B

      Summary statistics such as count, mean, minimum, and maximum

    3. C

      The frequency of every distinct value in every column

    4. D

      A list of all rows sorted by their index labels

    Correct answer
    B

    Summary statistics such as count, mean, minimum, and maximum

    Explanation

    .describe() provides summary statistics for numeric columns, including measures such as mean, minimum, and maximum.

  23. 23

    What does the mode of a numeric column identify?

    1. A

      The largest value in the column

    2. B

      The value that occurs most frequently

    3. C

      The average of all values

    4. D

      The value halfway between the minimum and maximum

    Correct answer
    B

    The value that occurs most frequently

    Explanation

    The mode is the most frequently occurring value.

  24. 24

    What additional information does .value_counts() provide beyond simply identifying a column's mode?

    1. A

      A frequency count for each distinct value

    2. B

      The average and standard deviation for each value

    3. C

      The number of columns that contain each value

    4. D

      The index label of the maximum value only

    Correct answer
    A

    A frequency count for each distinct value

    Explanation

    .value_counts() ranks distinct values by frequency and reports how many times each appears.

  25. 25

    How can the highest value appear first after sorting a column in pandas?

    1. A

      Sort the index with ascending=False

    2. B

      Sort by that column with ascending=False

    3. C

      Sort by that column with ascending=True

    4. D

      Apply .describe() before sorting

    Correct answer
    B

    Sort by that column with ascending=False

    Explanation

    Descending sorting places higher values before lower ones, which is specified with ascending=False.

  26. 26

    What does sorting by multiple columns allow you to do?

    1. A

      Calculate a separate average for each column

    2. B

      Filter out rows that fail either column's condition

    3. C

      Use one column as the primary sort and another as a further ordering criterion

    4. D

      Replace missing values based on both columns

    Correct answer
    C

    Use 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.

  27. 27

    After filtering to rows with a target value, how can the shortest matching word be found?

    1. A

      Sort the original index and choose the first row

    2. B

      Take the maximum value of the value column

    3. C

      Count the occurrences of each character count

    4. D

      Sort the remaining rows by character count or take the minimum character count

    Correct answer
    D

    Sort 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.

  28. 28

    Why might .value_counts() be inconvenient for searching a continuous ratio column?

    1. A

      It can only operate on columns containing strings

    2. B

      Many distinct ratio values may make the frequency output unwieldy

    3. C

      It automatically drops rows whose ratios are equal

    4. D

      It replaces the ratio values with their averages

    Correct answer
    B

    Many 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.

  29. 29

    Why can a histogram or box plot be useful early in data analysis?

    1. A

      It guarantees that every column has the correct data type

    2. B

      It automatically corrects all missing values

    3. C

      It gives a quick view of distributions, ranges, and possible unusual values

    4. D

      It identifies the exact cause of every data-quality issue

    Correct answer
    C

    It 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.

  30. 30

    What does setting invalid rating values to NaN accomplish in the app-data example?

    1. A

      It converts every rating into a string

    2. B

      It marks values outside the valid rating range as missing

    3. C

      It removes every app with a rating

    4. D

      It replaces all valid ratings with the column mean

    Correct answer
    B

    It marks values outside the valid rating range as missing

    Explanation

    Ratings above the valid maximum were treated as invalid and replaced with NaN so they could be handled as missing values.

  31. 31

    How were missing or invalid rating values filled in the example?

    1. A

      With the mean of the rating column

    2. B

      With the maximum value of the rating column

    3. C

      With the string unknown

    4. D

      With the most frequent app category

    Correct answer
    A

    With the mean of the rating column

    Explanation

    The example fills null rating values using the rating column's mean.

  32. 32

    Why did the reviews column remain an object rather than being parsed as numeric?

    1. A

      The column contained only missing values

    2. B

      Some entries contained nonnumeric text, such as a suffix for millions

    3. C

      Pandas stores every count column as an object

    4. D

      The reviews column was used as the DataFrame index

    Correct answer
    B

    Some entries contained nonnumeric text, such as a suffix for millions

    Explanation

    Entries with text such as M prevented pandas from parsing the entire reviews column as numeric.

  33. 33

    What is the purpose of using numeric conversion with errors='coerce' when checking a suspicious column?

    1. A

      Valid numeric values become strings for safe storage

    2. B

      Every row that contains a string is immediately deleted

    3. C

      Unparseable entries become missing values instead of stopping the conversion

    4. D

      All strings are converted to zero without inspection

    Correct answer
    C

    Unparseable 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.

  34. 34

    How were review counts with an M suffix handled before converting them to numbers?

    1. A

      Remove the suffix, convert the remaining text, then multiply by one million

    2. B

      Replace the suffix with a comma, then divide by one thousand

    3. C

      Keep the suffix and ask .describe() to parse it

    4. D

      Delete every row containing the suffix

    Correct answer
    A

    Remove 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.

  35. 35

    What does checking duplicates on a subset containing only the app-name column detect?

    1. A

      Rows with the same review count but different app names

    2. B

      Rows sharing an app name, even if other columns differ

    3. C

      Rows identical in every column only

    4. D

      Rows that have any missing value

    Correct answer
    B

    Rows 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.

  36. 36

    What is the effect of setting keep=False when identifying duplicates?

    1. A

      Only the last occurrence is marked as duplicated

    2. B

      Every occurrence of a duplicated value is marked as duplicated

    3. C

      Only the first occurrence is marked as duplicated

    4. D

      No occurrence is marked unless every column matches

    Correct answer
    B

    Every 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.

  37. 37

    Why sort app records by review count before dropping duplicates while keeping the last row?

    1. A

      To ensure duplicate names become unique strings

    2. B

      To retain the duplicate record with the greatest review count

    3. C

      To place missing review counts at the top of the DataFrame

    4. D

      To retain the duplicate record with the fewest review count

    Correct answer
    B

    To 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.

  38. 38

    How can category labels such as AUTO_PARTS be formatted as ordinary title-like text?

    1. A

      Convert the category to a numeric value

    2. B

      Sort the category values and select the first

    3. C

      Replace underscores with spaces and capitalize the result

    4. D

      Remove all letters after the underscore

    Correct answer
    C

    Replace underscores with spaces and capitalize the result

    Explanation

    The example replaces underscores with spaces and capitalizes the category text.

  39. 39

    What cleaning steps were used to convert install counts containing commas and plus signs?

    1. A

      Convert the values to dates, then remove the commas

    2. B

      Replace every digit with a plus sign, then call .value_counts()

    3. C

      Remove the commas and plus signs, then convert the values to numeric

    4. D

      Drop every row whose install count contains punctuation

    Correct answer
    C

    Remove 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.

  40. 40

    How should a size such as a value in kilobytes be converted to bytes, according to the example?

    1. A

      Remove the unit suffix, convert the number, and multiply by 102410241024

    2. B

      Remove the unit suffix, convert the number, and divide by 102410241024

    3. C

      Replace the unit suffix with a decimal point

    4. D

      Add 102410241024 to the text before converting it

    Correct answer
    A

    Remove the unit suffix, convert the number, and multiply by 102410241024

    Explanation

    The example converts kilobytes to bytes by multiplying the numeric value by 102410241024; megabytes require multiplying by 102410241024 twice.

  41. 41

    Why can keeping a copy of a DataFrame be useful during a cleaning workflow?

    1. A

      It prevents pandas from changing column data types

    2. B

      It ensures that later sorting operations are faster

    3. C

      It automatically validates every cleaning rule

    4. D

      It allows recovery of an earlier state if a modification causes a problem

    Correct answer
    D

    It 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.

  42. 42

    Why does domain knowledge matter when deciding whether data values are valid?

    1. A

      It guarantees that outliers are measurement errors

    2. B

      It removes the need to inspect data types

    3. C

      It lets pandas infer every missing value without rules

    4. D

      It helps determine realistic meanings, ranges, and constraints for the data

    Correct answer
    D

    It 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.

  43. 43

    What is the basic purpose of a pandas groupby operation?

    1. A

      Split records into groups, apply calculations, and combine the results

    2. B

      Convert every column to a categorical type

    3. C

      Merge two DataFrames using their index values

    4. D

      Sort all rows by every column and remove duplicates

    Correct answer
    A

    Split 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.

  44. 44

    To calculate total home goals by team, which grouping and aggregation are appropriate?

    1. A

      Group by home team and sum home goals

    2. B

      Group by season and take the maximum away goals

    3. C

      Group by away team and average home goals

    4. D

      Group by result and count home teams

    Correct answer
    A

    Group 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.

  45. 45

    How can the average number of goals per match be calculated when home and away goals are separate?

    1. A

      Count the unique values in both goal columns

    2. B

      Add home and away goals for each match, then take the mean

    3. C

      Group by the result and take the minimum of each column

    4. D

      Subtract away goals from home goals, then take the maximum

    Correct answer
    B

    Add 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.

  46. 46

    Why might the absolute value be used when finding the largest goal difference regardless of which side won?

    1. A

      It identifies which team was the home team

    2. B

      It removes matches with equal scores

    3. C

      It compares the magnitude of the difference without regard to its sign

    4. D

      It converts the goal counts into percentages

    Correct answer
    C

    It 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.

  47. 47

    When counting a team's away wins, what should be counted within each away-team group?

    1. A

      The number of distinct home-team names

    2. B

      The total number of goals scored at home

    3. C

      Rows whose result indicates a home win

    4. D

      Rows whose result indicates an away win

    Correct answer
    D

    Rows 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.

  48. 48

    When aggregating goals received at home by each team, which goal column should be summed?

    1. A

      The difference between home and away goals

    2. B

      Away goals

    3. C

      Home goals

    4. D

      Total goals scored by the home team

    Correct answer
    B

    Away 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.

  49. 49

    Why should goals received be compared per home match rather than only by the total?

    1. A

      Home goals and away goals always have identical totals

    2. B

      Teams may have played different numbers of home matches

    3. C

      A total cannot be calculated from numeric columns

    4. D

      The result column stores the number of matches played

    Correct answer
    B

    Teams 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.

  50. 50

    What does groupby(...).transform('max') do differently from a simple groupby maximum aggregation?

    1. A

      It replaces the grouping column with the maximum

    2. B

      It broadcasts each group's maximum back to the rows in that group

    3. C

      It returns only one row for each group

    4. D

      It sorts each group by its maximum value

    Correct answer
    B

    It 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.

  51. 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?

    1. A

      Group by player and count the number of teams

    2. B

      Sort the team names alphabetically and select the first row

    3. C

      Keep rows where the player's points equal the broadcast team maximum

    4. D

      Keep rows whose points are below the team maximum

    Correct answer
    C

    Keep 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.

  52. 52

    How can the most frequent primary type among legendary Pokémon be found?

    1. A

      Count the number of columns in the filtered DataFrame

    2. B

      Group by secondary type and take its mean

    3. C

      Sort all Pokémon by speed and take the last row

    4. D

      Filter to legendary Pokémon, select primary type, then use .value_counts()

    Correct answer
    D

    Filter 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.

  53. 53

    What is the role of a Cartesian product when comparing company names from two datasets?

    1. A

      It creates every possible pairing of a name from the first dataset with one from the second

    2. B

      It removes repeated company names from both datasets

    3. C

      It sorts each dataset independently by company name

    4. D

      It matches only names that are already identical

    Correct answer
    A

    It 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.

  54. 54

    Why can representing company comparisons as a DataFrame be more useful than only using nested loops?

    1. A

      It reduces the number of possible company pairs to identical names

    2. B

      It guarantees that every similarity score is correct

    3. C

      It makes comparisons available for filtering, sorting, and visual analysis

    4. D

      It avoids calculating any similarity scores

    Correct answer
    C

    It 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.

  55. 55

    What does a fuzzy string-similarity score help estimate?

    1. A

      How many characters are in the longer string only

    2. B

      How many times a string appears in a DataFrame

    3. C

      How similar two strings are despite differences in their spelling or formatting

    4. D

      Whether two numeric columns have the same mean

    Correct answer
    C

    How 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.

  56. 56

    Why was a partial string ratio useful for matching company names in the example?

    1. A

      It ignores all spaces and punctuation by deleting the names

    2. B

      It converts company names into numerical identifiers

    3. C

      It requires the complete strings to be exactly equal

    4. D

      It can identify matching portions even when one name contains additional words

    Correct answer
    D

    It 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.

  57. 57

    What is an important limitation of using a fixed similarity-score cutoff for company matching?

    1. A

      A high-scoring pair may still represent different entities

    2. B

      A score cutoff makes string data impossible to sort

    3. C

      Every score above the cutoff is guaranteed to be a true match

    4. D

      The cutoff automatically accounts for business context

    Correct answer
    A

    A 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.

  58. 58

    Why is domain knowledge especially valuable after fuzzy matching produces plausible company pairs?

    1. A

      It ensures the product contains fewer pairs

    2. B

      It converts each company name into a valid date

    3. C

      It increases the computed similarity score automatically

    4. D

      It helps decide whether similar names refer to the same real-world entity

    Correct answer
    D

    It 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.

  59. 59

    In the birthday-pair method, what does generating combinations of two players allow you to check?

    1. A

      Whether every player has a unique birthday

    2. B

      Whether players belong to the same team in different seasons

    3. C

      Whether each birthday occurs in the same year

    4. D

      Whether the birthdays of each distinct pair match

    Correct answer
    D

    Whether the birthdays of each distinct pair match

    Explanation

    Pairwise combinations create the pairs whose birthday values can be compared for equality.

  60. 60

    Why are there more possible pairs when another person joins a group?

    1. A

      The new person can only pair with the first person

    2. B

      The new person forms a pair with each person already in the group

    3. C

      The number of pairs increases by exactly one

    4. D

      The new person duplicates every existing pair

    Correct answer
    B

    The 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.

  61. 61

    What counterintuitive result about the birthday problem is stated in the content?

    1. A

      More than 300 people are needed for a chance above 50%

    2. B

      Two people always share a birthday in any group of 23

    3. C

      A group of 23 people is enough for the chance of a shared birthday to exceed 50%

    4. D

      A group of 23 people guarantees that everyone has a different birthday

    Correct answer
    C

    A 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.

  62. 62

    Why can the year be omitted when comparing birthdays for a shared-birthday question?

    1. A

      The year is needed only when sorting names

    2. B

      The year determines the number of player pairs

    3. C

      The year is always the same for every player

    4. D

      The comparison concerns month and day, even if the birth years differ

    Correct answer
    D

    The 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.

  63. 63

    What is the purpose of formatting a birth-date column to month and day before matching birthdays?

    1. A

      It sorts the players by their age automatically

    2. B

      It makes every date unique across the dataset

    3. C

      It creates comparable values that ignore the birth year

    4. D

      It converts each birthday into a team identifier

    Correct answer
    C

    It 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.

  64. 64

    What does a left merge preserve when the season statistics DataFrame is on the left?

    1. A

      All rows from the season statistics, with matching player details added where available

    2. B

      Only rows that match in both DataFrames

    3. C

      Only rows whose player details contain no missing values

    4. D

      All rows from the player-details DataFrame and no unmatched season rows

    Correct answer
    A

    All 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.

  65. 65

    If a player name is missing after a left merge, what does that indicate in the described example?

    1. A

      The player's college value was missing

    2. B

      The player necessarily had no NBA statistics

    3. C

      The merge did not find a matching player record for that row

    4. D

      The left DataFrame contained no rows

    Correct answer
    C

    The 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.

  66. 66

    How can a merge use different key-column names in the two DataFrames?

    1. A

      Specify the left key and right key separately

    2. B

      Rename both DataFrames to the same variable name

    3. C

      Convert both keys to index positions and use .shape

    4. D

      Drop one key and merge on every remaining column

    Correct answer
    A

    Specify 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.

  67. 67

    Why did some NBA player rows fail to match even though the player existed in the details data?

    1. A

      The left merge removed every player with a birthday

    2. B

      The player had a numeric team name instead of a string

    3. C

      The player's name had changed or was represented differently between datasets

    4. D

      The season statistics contained no player-name column

    Correct answer
    C

    The 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.

  68. 68

    What does converting a birth-date column with to_datetime enable?

    1. A

      Conversion of team labels into numeric codes

    2. B

      Automatic matching of names across DataFrames

    3. C

      Date-aware operations, such as calculating time differences or means

    4. D

      Automatic removal of duplicate players

    Correct answer
    C

    Date-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.

  69. 69

    In the youngest-team comparison, why does the team with the latest average birth date have the youngest squad?

    1. A

      A more recent birth date corresponds to a younger age

    2. B

      The average birth date is the team's most frequent birthday

    3. C

      A later birth date indicates a lower player count

    4. D

      A later date always means a larger number of games played

    Correct answer
    A

    A 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.

Question 1 of 69
Question 1 of 69

Ask anything

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

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent