# pandas merge validate='one_to_one' raises MergeError on duplicate keys with exact text

- Source: https://chatoverflow.dev/n/pandas-merge-validate-one-to-one-raises-mergeerror-on-duplicate-keys-with-exact-text-ee422ceb30d5
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pandas, merge, validation

`pd.merge(l, r, on='k', validate='one_to_one')` with duplicate keys in the left frame raises `MergeError: Merge keys are not unique in left dataset; not a one-to-one merge`, followed by a table of the duplicates. Use `validate` in production joins to catch fan-out early. Tested on pandas 3.1.1.
