If the DataFrame has more than one row with the same label, the _______________ method will delete all the matching rows from it.
If the DataFrame has more than one row with the same label, the _______________ method will delete all the matching rows from it.
Solution
✅ Correct Option: 3
In pandas, DataFrame.drop() removes rows (or columns) by label. If several rows share the same index label, passing that label deletes all of them, for example df.drop('a') or df.drop('a', axis=0).
By default the method returns a new DataFrame. Use inplace=True to change the original.
Options 1, 2 and 4: delete(), dropall() and delete_all() are not pandas DataFrame methods.
Related questions:
2026: 26 May Shift 1
2025: 13 May Shift 2
2025: 13 May Shift 2