Skip to main contentSkip to solution

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.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question