Skip to content

ENH/BUG: allow single versus multi-index joining on inferred level (GH3662) #6356

New issue

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

Closed
wants to merge 1 commit into from

Conversation

jreback
Copy link
Contributor

@jreback jreback commented Feb 14, 2014

WIP on #3662

In [4]:  household.join(portfolio, how='inner')
Out[4]: 
                           male    wealth                            name  share
household_id asset_id                                                           
1            nl0000301109     0  196087.3                        ABN Amro   1.00
2            nl0000289783     1  316478.7                          Robeco   0.40
             gb00b03mlx29     1  316478.7               Royal Dutch Shell   0.60
3            gb00b03mlx29     0  294750.0               Royal Dutch Shell   0.15
             lu0197800237     0  294750.0  AAB Eastern Europe Equity Fund   0.60
             nl0000289965     0  294750.0          Postbank BioTech Fonds   0.25

[6 rows x 4 columns]

In [5]:  household.join(portfolio, how='outer')
Out[5]: 
                           male    wealth                            name  share
household_id asset_id                                                           
1            nl0000301109     0  196087.3                        ABN Amro   1.00
2            nl0000289783     1  316478.7                          Robeco   0.40
             gb00b03mlx29     1  316478.7               Royal Dutch Shell   0.60
3            gb00b03mlx29     0  294750.0               Royal Dutch Shell   0.15
             lu0197800237     0  294750.0  AAB Eastern Europe Equity Fund   0.60
             nl0000289965     0  294750.0          Postbank BioTech Fonds   0.25
4            NaN            NaN       NaN                             NaN   1.00

[7 rows x 4 columns]

In [8]: household.index.name='foo'

In [9]: household.join(portfolio, how='outer')

ValueError: cannot join with no level specified and no overlapping names

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement MultiIndex Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant