pd.merge(a, b, on='id', validate='one_to_one') raises a MergeError. What does that tell you?
Correct answer
D. At least one side repeats a key value, so the join would produce duplicate rows
15 views
D. At least one side repeats a key value, so the join would produce duplicate rows
15 views
Merge validation checks the cardinality of the join keys, so 'one_to_one' fails when either frame repeats a key, which would otherwise multiply rows silently. The other settings are 'one_to_many', 'many_to_one' and 'many_to_many'. It is the quickest guard against the fan-out bug that inflates totals after a join.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is D? Ask here and get an explanation.