Question:easy

While appending two dataframes, if we want to raise error in case row labels are duplicate, we shall use which parameter of append() method?

Show Hint

The parameter verify_integrity=True checks the new index for duplicates and raises ValueError.
Updated On: Oct 1, 2026
  • ignore_index = False
  • row_index = False
  • in_place = True
  • verify_integrity = True
Show Solution

The Correct Option is D

Solution and Explanation

Step 1: Idea:
Read the question as a requirement: we need a switch that makes pandas stop with an error on a repeated row label. We look for the option whose name and effect match this requirement, and drop names that do not exist.

Step 2: Sort the options into real and made-up names.
Real parameters of append() are other, ignore_index, verify_integrity and sort. So row_index and in_place are not real names and go out first.

Step 3: Compare the two real ones.
ignore_index decides whether to throw away the old labels and renumber. It never raises an error. verify_integrity decides whether to check the final index for repeated labels. It raises a ValueError when a repeat exists.

Step 4: A small example.
Take two DataFrames that both have the row label 0. Joining them with verify_integrity=True stops with a ValueError about overlapping index values. With the default False, the join works and label 0 simply appears twice.

Step 5: Extra check.
Here is a short memory aid. The word integrity means that the data is sound and has no clash. Setting verify_integrity to True asks pandas to protect the soundness of the index, so it stops the join if two rows share a label. The word ignore in ignore_index tells us it throws labels away, and that is a different job. Note that newer pandas versions removed append(), and concat() takes the same verify_integrity argument.

Step 6: Conclusion.
Only option 4 raises the error we want. \[ \boxed{\text{verify\_integrity = True}} \]
Was this answer helpful?
0


Questions Asked in CUET (UG) exam