What does pd.merge(left, right, how='outer', indicator=True) add to the result?
Correct answer
D. A _merge column whose values are left_only, right_only or both, showing each row's origin
12 views
D. A _merge column whose values are left_only, right_only or both, showing each row's origin
12 views
Merge diagnostics: indicator=True adds a categorical _merge column recording whether each output row came from the left frame, the right frame or a match, which makes row-count discrepancies easy to explain. Without it, an unexpected increase in rows usually means duplicate keys on one side. Use validate='one_to_many' or 'one_to_one' to fail fast on such duplication.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is D? Ask here and get an explanation.