I can’t get “empty” inner joins to work with a MultiIndex. Under 0.10.1, I have:
d1 = pd.DataFrame({
'i1': [1, 2, 2],
'i2': [1, 1, 2],
'a': [10,20,30]}).set_index(['i1', 'i2'])
d2 = pd.DataFrame({
'i1': [3, 3],
'i2': [1, 2],
'b': [40, 50]}).set_index(['i1', 'i2'])
d1.join(d2, how='inner')
which gives me
Exception: Cannot infer number of levels from empty list
Is there any good way around this? I’d like to be able to tell in advance if the intersection is empty, so I can avoid the exception.
It is easier to ask forgiveness than permission: