We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
on
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Now that we support merging on combination of column names and index levels, this should work
In [40]: a = pd.DataFrame({"A": [1, 2, 3, 4]}, index=pd.MultiIndex.from_product([['a', 'b'], [0, 1]], names=['outer', 'inner'])) In [41]: b = pd.Series([1, 2, 3, 4], index=pd.MultiIndex.from_product([['a', 'b'], [1, 2]], names=['outer', 'inner']), name='B') In [42]: pd.merge(a, b, on=['outer', 'inner']) --------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-42-337c5a9e9f8f> in <module>() ----> 1 pd.merge(a, b, on=['outer', 'inner']) ~/Envs/dask-dev/lib/python3.6/site-packages/pandas/core/reshape/merge.py in merge(left, right, how, on, left_on, right_on, left_index, right_index, sort, suffixes, copy, indicator, validate) 58 right_index=right_index, sort=sort, suffixes=suffixes, 59 copy=copy, indicator=indicator, ---> 60 validate=validate) 61 return op.get_result() 62 ~/Envs/dask-dev/lib/python3.6/site-packages/pandas/core/reshape/merge.py in __init__(self, left, right, how, on, left_on, right_on, axis, left_index, right_index, sort, suffixes, copy, indicator, validate) 524 if not isinstance(right, DataFrame): 525 raise ValueError('can not merge DataFrame with instance of ' --> 526 'type {right}'.format(right=type(right))) 527 528 if not is_bool(left_index): ValueError: can not merge DataFrame with instance of type <class 'pandas.core.series.Series'>
Should be the same as
In [39]: pd.merge(a, b.to_frame(), on=['outer', 'inner']) Out[39]: A B outer inner a 1 2 1 b 1 4 3
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Now that we support merging
on
combination of column names and index levels, this should workShould be the same as
The text was updated successfully, but these errors were encountered: