df.drop_duplicates(subset=['email'], keep='last') is applied to a frame with repeated emails. What is retained?
Correct answer
C. The last occurrence of each email in the current row order, dropping the earlier ones
15 views
C. The last occurrence of each email in the current row order, dropping the earlier ones
15 views
drop_duplicates compares the chosen subset of columns and keeps one row per distinct combination, with keep controlling whether the first, last or none survives. keep='last' keeps the final occurrence in the frame's current order, so sorting beforehand decides which record wins. keep=False removes every duplicated row, which is useful for isolating conflicts.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is C? Ask here and get an explanation.