CARVIEW |
Checking and Handling Duplicate Values
Checking & Handling Duplicate Values
Question 1
What does the duplicated()
method in Pandas return?
A DataFrame with duplicates removed
The number of duplicate rows
A Boolean Series marking duplicate rows
The last duplicate row only
Question 2
Which row is marked as duplicate when using duplicated()
?
The first occurrence
The last occurrence
All matching rows
All except the first occurrence
Question 3
How can you mark the first occurrence as duplicate in duplicated()
?
duplicated(first=True)
duplicated(last=True)
duplicated(keep='first')
duplicated(keep='none')
Question 4
What is the default behavior of duplicated()
in Pandas?
Keeps the first duplicate
Marks only the last duplicate
Ignores duplicates
Marks all but the first as
True
Question 5
What does drop_duplicates()
do in Pandas?
Deletes the DataFrame
Removes duplicate columns
Removes duplicate rows
Keeps only duplicate rows
Question 6
Which parameter is used in drop_duplicates()
to specify which columns to check?
subset
columns
axis
key
Question 7
What does drop_duplicates(keep='last')
do?
Removes all duplicates
Keeps the first duplicate
Keeps the last duplicate
Drops the last duplicate
Question 8
What will drop_duplicates(keep=False)
do?
Keep all rows
Keep only the first duplicate
Drop all duplicate rows
Keep all duplicates
There are 8 questions to complete.