Pandas for Data Analysis
- 73Unfamiliar
- 0Learning
- 0Familiar
- 0Mastered
73 questions
- 1In pandas, the info method summarizes a DataFrame's index, columns, data types, and non-null entries, while_____reports its row and column dimensions.
Hint
Think of the attribute that returns a pair of dimensions.
Answer
shape
Explanation
The shape attribute gives the number of rows and columns; info provides a fuller structural summary.
- 2When a DataFrame uses each English word as its index, selecting a particular word by its label is done with_____.
Hint
This label-based selector can retrieve a row by its index value.
Answer
loc
Explanation
The loc method selects rows by index label, so a word used as an index can identify its row.
- 3Selecting a single row with loc usually returns a vertical_____rather than a horizontal DataFrame row.
Hint
It is pandas' one-dimensional labeled data structure.
Answer
Series
Explanation
A single selected row is represented as a Series, with the column names serving as its index.
- 4To retrieve just one column while selecting a row with loc, provide the index selection and the_____selection.
Hint
This limits the returned data to a named field such as value.
Answer
column
Explanation
loc accepts row labels or conditions and, optionally, column labels to restrict which fields are returned.
- 5The DataFrame method that provides summary statistics such as mean, standard deviation, minimum, and maximum is_____.
Hint
Its name suggests giving a statistical overview of the data.
Answer
describe
Explanation
describe returns summary statistics for numeric columns, including count, mean, standard deviation, minimum, and maximum.
- 6To find the greatest value in a numeric Series, call its_____method.
Hint
It is the statistical method for obtaining the largest value.
Answer
max
Explanation
The max method returns the maximum value in a Series or, when applied to a DataFrame, for each applicable column.
- 7For a numeric Series, the statistical method that returns its most frequently occurring value is_____.
Hint
It names the measure of central tendency based on frequency.
Answer
mode
Explanation
The mode method returns the value or values that occur most often.
- 8To see how often each distinct value occurs, use the Series method_____.
Hint
This method produces a frequency ranking, not just a single most-common value.
Answer
value counts
Explanation
value counts reports the frequency of each distinct value, making it useful for ranking common values.
- 9In the English-words dataset, character count was calculated as the_____of each word.
Hint
Count how many characters the word contains.
Answer
length
Explanation
The character count column represents the length of each word.
- 10To create a word's value in the example dataset, the individual character values were_____.
Hint
The word's total was obtained by combining the values of its letters.
Answer
added
Explanation
Each character was assigned a value, such as A being one and B being two, and the character values were added to produce the word's value.
- 11A loc selection can take one index label, a list of labels, or a Boolean_____indicating which rows to select.
Hint
It contains true and false values corresponding to rows.
Answer
array
Explanation
loc supports a single label, multiple labels, or a Boolean array that marks rows for inclusion.
- 12A condition such as value equals 319 creates a Boolean array; rows whose condition is true are retained by_____.
Hint
This selector applies label-based and Boolean-mask selection.
Answer
loc
Explanation
The Boolean mask can be passed to loc to select rows satisfying the condition.
- 13Summing a Boolean Series in pandas counts the number of_____values because true is treated as one.
Hint
A true value contributes one to the sum.
Answer
true
Explanation
Boolean values act like zeros and ones in a sum, so summing a condition counts matching rows.
- 14In a pandas Boolean selection, the ampersand operator combines conditions with logical_____.
Hint
Both conditions must be satisfied for a row to be selected.
Answer
and
Explanation
The ampersand combines Boolean masks element by element as an AND operation.
- 15To select rows matching either of two Boolean conditions, combine the masks with the vertical bar, which represents logical_____.
Hint
A row can match the first condition, the second, or both.
Answer
or
Explanation
The vertical bar combines Boolean masks element by element as an OR operation.
- 16When a pandas query refers to a column name containing spaces, surround the column name with_____.
Hint
These are the marks commonly used around inline code in Markdown.
Answer
backticks
Explanation
The query method uses backticks around column names containing spaces so it can parse them correctly.
- 17In a pandas query, prefix an external Python variable with the_____symbol to distinguish it from a column name.
Hint
This symbol is used to refer outside the query expression.
Answer
@
Explanation
Within query, column names are interpreted as columns by default; the at symbol references a variable from the surrounding scope.
- 18When combining complex Boolean conditions, parentheses help ensure the intended order of_____.
Hint
They control which parts of an expression are evaluated together first.
Answer
operations
Explanation
Parentheses make the desired grouping explicit, especially when combining AND and OR conditions.
- 19The pandas method presented as a concise alternative for expressing simple conditions in a string-like form is_____.
Hint
It lets you write conditions using column names in an expression.
Answer
query
Explanation
The query method is a shorthand for filtering with straightforward conditions; loc remains useful for more flexible Boolean-mask selection.
- 20In the Pokémon data, a Boolean column such as legendary can itself be passed to loc as a_____for selecting rows.
Hint
It indicates which rows are included using true and false values.
Answer
mask
Explanation
Because legendary is already Boolean, it can directly serve as a mask to select legendary Pokémon.
- 21The logical negation operator can invert a Boolean mask to select Pokémon that are_____legendary.
Hint
It reverses true and false values in the mask.
Answer
not
Explanation
Negating the legendary Boolean Series selects rows where the legendary status is false.
- 22To count the Pokémon whose attack is greater than 150, one can select matching rows and inspect the result's_____.
Hint
Its row dimension gives the number of matches.
Answer
shape
Explanation
The shape of the filtered DataFrame reveals how many Pokémon met the attack condition; summing the Boolean condition also counts them.
- 23A Pokémon with speed 10 or less satisfies a condition written as speed less than or equal to_____.
Hint
This is the threshold specified for slow Pokémon in the activity.
Answer
10
Explanation
The inclusive condition retains Pokémon whose speed is 10 or any smaller value.
- 24To find a Pokémon with both type one equal to fire and type two equal to flying, combine the two conditions with logical_____.
Hint
Both type requirements must hold for the same Pokémon.
Answer
and
Explanation
An AND condition selects rows only when both the primary-type and secondary-type conditions are true.
- 25To find Pokémon that have poison in either type field, combine the type one and type two conditions with logical_____.
Hint
A match in either field is sufficient.
Answer
or
Explanation
An OR condition retains Pokémon whose type one or type two is poison.
- 26The is in method can express that a generation belongs to a chosen set, avoiding a longer chain of equality tests joined by_____.
Hint
It links alternative possibilities in a Boolean expression.
Answer
or
Explanation
Using is in with a collection of generations is a concise way to test membership instead of writing repeated OR conditions.
- 27To identify the most powerful Pokémon under a numeric measure such as total, sort the values with ascending set to_____.
Hint
This places the largest values at the beginning.
Answer
false
Explanation
Descending sorting places the highest total or other numeric value first, making the leading row the maximum.
- 28When sorting on multiple Pokémon statistics, pandas applies the listed columns as successive sorting_____.
Hint
The first column is considered before the next one.
Answer
criteria
Explanation
Multiple sort columns provide a primary criterion and additional tie-breaking criteria; each can have its own ascending direction.
- 29A histogram or box plot can help begin analysis by showing the distribution and potential_____in numeric data.
Hint
These are observations unusually far from the rest of the values.
Answer
outliers
Explanation
Visualizations such as histograms and box plots provide a quick view of ranges, distributions, and unusual values.
- 30The birthday paradox asks how many people are needed for the probability that at least two share a birthday to exceed_____percent.
Hint
The surprising threshold occurs with a relatively small group.
Answer
50
Explanation
The birthday paradox states that only 23 people are needed for the probability of a shared birthday to exceed 50 percent.
- 31The birthday paradox reaches a probability above 50 percent with only_____people in a room.
Hint
This counterintuitively small number is the central result of the example.
Answer
23
Explanation
With 23 people, the number of possible pairs makes a shared birthday more likely than many people intuitively expect.
- 32In a non-leap year, at least_____people are needed to guarantee that two people share a birthday.
Hint
There are 365 possible calendar days in the assumed year.
Answer
366
Explanation
With 365 days, 366 people guarantee that at least two share a birthday by the pigeonhole principle.
- 33The birthday probability calculation considers possible pairs using the number of combinations of n people taken_____.
Hint
A shared birthday is checked between two people at a time.
Answer
two
Explanation
The number of candidate pairs is the number of combinations of the group taken two at a time.
- 34When one more person joins a group, the number of new pairs increases by the number of people already in the_____.
Hint
The newcomer can pair with every person already present.
Answer
room
Explanation
Each added person forms a new pair with every existing person, so the increase equals the previous group size.
- 35To compare NBA players' birthdays regardless of birth year, extract the_____and day from each birth date.
Hint
A birthday match ignores the year but retains two calendar components.
Answer
month
Explanation
The birthday comparison uses month and day only, because people can share a birthday even when born in different years.
- 36The pandas datetime string formatting operation used to extract month and day from a date column is strftime through the_____accessor.
Hint
This accessor is used for datetime Series operations.
Answer
dt
Explanation
The dt accessor exposes datetime operations, including strftime formatting, for a pandas datetime Series.
- 37The itertools function that generates pairs of players without comparing a player with themself is_____.
Hint
It generates unordered selections of a chosen size.
Answer
combinations
Explanation
combinations creates each distinct pair once, which is suitable for checking which pairs share a birthday.
- 38For matching company names, the Levenshtein-distance-based library used in the example was_____.
Hint
It provides similarity functions such as partial ratio.
Answer
fuzz
Explanation
The fuzz library was used to compute similarity scores between company-name strings.
- 39The fuzz method selected for comparing company names with extra words or partial overlap was_____.
Hint
It compares meaningful parts of strings rather than requiring a full-string match.
Answer
partial ratio
Explanation
partial ratio was chosen because company names may contain additional words or differ in how their full names are written.
- 40A similarity score near 100 from the partial ratio method indicates that the compared strings are highly_____.
Hint
It describes closeness between the two company-name strings.
Answer
similar
Explanation
The score is interpreted as similarity: a high score means the strings have a close match under the method.
- 41Creating every possible pairing between two company-name lists is a Cartesian product, which can be generated with itertools._____.
Hint
This function combines each item from one collection with each item from another.
Answer
product
Explanation
itertools.product generates all cross-list pairs, allowing each name in one dataset to be compared with every name in the other.
- 42A data-driven company-matching workflow can store both names and their similarity score in a single_____.
Hint
This tabular structure makes filtering and inspection easier.
Answer
DataFrame
Explanation
Putting candidate pairs and their scores into a DataFrame supports sorting, filtering, plotting, and reviewing possible matches.
- 43A fixed similarity cutoff can produce false matches, so borderline name comparisons should be checked using_____knowledge.
Hint
This knowledge concerns the business or subject area represented by the data.
Answer
domain
Explanation
Similarity alone may confuse distinct entities that share words; domain knowledge is needed to decide whether borderline pairs represent the same entity.
- 44The similarity method in the example can recognize names such as Apple and Apple Inc. by focusing on partial string_____.
Hint
It identifies shared portions despite extra text in one name.
Answer
matches
Explanation
Partial ratio can score shared parts highly even when one company name includes additional words or abbreviations.
- 45The first step in investigating a messy dataset is to inspect its structure and data types, for example with the DataFrame method_____.
Hint
It displays column types and non-null counts.
Answer
info
Explanation
info helps identify suspicious types, missing entries, and the overall structure before cleaning begins.
- 46For app ratings known to be on a scale from one to five, values greater than five are_____.
Hint
They fall outside the domain's allowed rating range.
Answer
invalid
Explanation
Understanding the rating scale makes values above five identifiable as invalid; the example replaced such values with missing values.
- 47The missing-data marker assigned to invalid ratings in the example was_____.
Hint
It is the conventional pandas and NumPy marker for a missing numeric value.
Answer
NaN
Explanation
Invalid ratings were set to NaN, after which missing ratings could be filled with the mean.
- 48After invalid ratings were marked missing, the example filled missing rating values using the column's_____.
Hint
It is the arithmetic average of the available rating values.
Answer
mean
Explanation
The rating column's mean was used to fill missing values in the example.
- 49When a small number of rows have missing values in other columns, the DataFrame method used to remove those rows is_____.
Hint
Its name refers to dropping missing values.
Answer
dropna
Explanation
dropna removes rows with missing values; the example used it for a handful of incomplete app records.
- 50The pandas function that attempts to convert strings such as review counts into numeric values is_____.
Hint
It converts a Series to a numeric type when possible.
Answer
to numeric
Explanation
to numeric parses numeric strings; using errors set to coerce turns unparseable entries into NaN for investigation.
- 51In the reviews column, the letter M represented a count in the_____range and had to be removed and scaled.
Hint
A value written as 2M represents two of these units.
Answer
millions
Explanation
The M suffix indicated millions; the example removed it, converted the remaining text, and multiplied by one million.
- 52To count repeated app names regardless of differences in other columns, use duplicated with the app column specified through the_____parameter.
Hint
It limits duplicate checking to selected columns.
Answer
subset
Explanation
Setting subset to app checks whether app names repeat even when other fields, such as review counts, differ.
- 53To mark every occurrence of a duplicated app name, including its first occurrence, set keep to_____.
Hint
This option does not preserve one occurrence as the unique original.
Answer
false
Explanation
With keep set to false, duplicated marks every occurrence of a repeated value rather than only later copies.
- 54After sorting duplicate app records by reviews, keeping the row with the greatest review count requires drop duplicates with keep set to_____.
Hint
In ascending order, the greatest review count appears at the end.
Answer
last
Explanation
Sorting reviews in ascending order and keeping the last duplicate retains the record with the most reviews.
- 55To convert category labels from uppercase words joined by underscores into readable labels, replace underscores with spaces and apply_____.
Hint
This string operation gives the label conventional capitalization.
Answer
capitalize
Explanation
The example replaced underscores with spaces and capitalized the resulting category text.
- 56When cleaning app sizes, a value in kilobytes is converted to bytes by multiplying by_____.
Hint
This is the conversion factor used for each binary size step in the example.
Answer
1024
Explanation
Kilobytes were multiplied by 1024 to express sizes in bytes; megabytes required applying that factor twice.
- 57The Premier League result column had three valid categories: home win, away win, and_____.
Hint
It occurs when the home and away sides score the same number of goals.
Answer
draw
Explanation
The valid result categories were home victory, away victory, and draw; inconsistent results could be recalculated from the goals.
- 58In the season column, a question mark did not match the season pattern and was replaced with_____.
Hint
The replacement explicitly indicates that the season could not be identified.
Answer
unknown season
Explanation
The invalid question-mark entries were replaced by the category unknown season.
- 59Because a football match cannot have a negative score, negative home and away goal values were replaced with_____.
Hint
This is the minimum possible goal count in a match.
Answer
zeros
Explanation
Negative goal counts fell outside the valid range and were cleaned by setting them to zero.
- 60The total goals column for a match is calculated by adding home goals and_____goals.
Hint
It refers to the visiting team's score.
Answer
away
Explanation
Total goals are the sum of the home team's and away team's goal counts.
- 61To calculate average goals for each season, group by season and apply the mean to the_____goals column.
Hint
This column combines home and away goals for each match.
Answer
total
Explanation
Grouping matches by season and averaging total goals gives the average goals per match in each season.
- 62When the direction of the goal difference does not matter, use the_____operation to compare its magnitude.
Hint
It removes the negative sign while preserving the size of a value.
Answer
absolute
Explanation
Taking the absolute value treats a win by six goals the same in magnitude whether the home or away team won.
- 63To identify the team with the most away wins, group by away team and count or sum the rows whose result indicates an away_____.
Hint
It is the result category for a victory by the visiting side.
Answer
win
Explanation
Grouping by away team and counting away-win results identifies which team won the most matches while playing away.
- 64In a groupby workflow, the common description of splitting data into groups, applying an operation, and recombining the results is split, apply, and_____.
Hint
It is the final stage when grouped results are assembled again.
Answer
combine
Explanation
Groupby follows a split-apply-combine pattern: form groups, compute within groups, and combine the results.
- 65To find the home team that scored the most goals at home, group by home team and calculate the_____of home goals.
Hint
This aggregates all the team's home goals across its matches.
Answer
sum
Explanation
Summing home goals within each home-team group gives each team's total goals scored at home.
- 66A left merge of 2017 season statistics with player information retains all rows from the_____DataFrame.
Hint
The left-hand table is the one whose rows are preserved.
Answer
left
Explanation
A left join preserves every row from the left table and brings in matching information from the right table.
- 67When merging the NBA season statistics and player information, the player identifier in the season table was matched to the player's_____field.
Hint
The two tables used different column labels for the matching information.
Answer
name
Explanation
The merge matched the season table's player column with the players table's name column.
- 68After a merge, missing values in a non-nullable name field can indicate that the player records did not_____.
Hint
The two tables may use different spellings or versions of a name.
Answer
match
Explanation
If the name field should always exist, a missing merged name indicates that the join did not find a corresponding player record.
- 69To replace team abbreviations with full team names using a mapping, the Series method used was_____.
Hint
It substitutes matching values according to a mapping.
Answer
replace
Explanation
The replace method applies the abbreviation-to-full-name mapping to the team column.
- 70A player appearing for the special TOT team represents an aggregate across teams; those total rows were removed to avoid counting the player_____.
Hint
The player may also appear in separate rows for individual teams.
Answer
twice
Explanation
The total row aggregates the player's statistics across teams, so retaining it alongside team-specific rows would duplicate the player's contribution.
- 71To convert a birthday string column to pandas datetime values, use pandas_____.
Hint
It parses date-like strings into datetime objects.
Answer
to datetime
Explanation
to datetime converts the birthday column from strings to datetime values, enabling date-based operations.
- 72The groupby transform operation can attach each team's maximum points value back to every player row in that team, preserving the original_____.
Hint
The transformed result aligns with the original rows instead of collapsing to one row per group.
Answer
shape
Explanation
Unlike an aggregation that reduces each group to one result, transform returns group calculations aligned with the original DataFrame rows.
- 73When calculating the average player birthday by team, a more recent mean birth date indicates a_____squad.
Hint
Players born later have more recent birthdays and are younger at a fixed reference date.
Answer
younger
Explanation
For a fixed reference date, a later average birth date corresponds to a lower average age and therefore a younger squad.

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