ENH: Join - Add a parameter to check for duplicates · Issue #46622 · pandas-dev/pandas (original) (raw)

It is arguably more common than not to join dataframes on a unique index. Optional check for uniqueness would help to prevent hidden errors and time spent on debugging.

Describe the solution you'd like

DataFrame.join should get a new parameter on_unique that would, if set to True, check if the index/columns on which joining is performed have duplicates and raise error if yes. Default should be False to keep backward compatibility.

API breaking implications

Default set to False ensures no issues with compatibility.