pandas.errors.MergeError#
- exception pandas.errors.MergeError[source]#
Exception raised when merging data.
Subclass of
ValueError
.Examples
>>> left = pd.DataFrame( ... {"a": ["a", "b", "b", "d"], "b": ["cat", "dog", "weasel", "horse"]}, ... index=range(4), ... ) >>> right = pd.DataFrame( ... {"a": ["a", "b", "c", "d"], "c": ["meow", "bark", "chirp", "nay"]}, ... index=range(4), ... ).set_index("a") >>> left.join( ... right, ... on="a", ... validate="one_to_one", ... ) Traceback (most recent call last): MergeError: Merge keys are not unique in left dataset; not a one-to-one merge