Skip to content
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

Referencing hierarchical columns gives error in seaborn 0.11 #2263

Closed
Maltimore opened this issue Sep 9, 2020 · 3 comments · Fixed by #2386
Closed

Referencing hierarchical columns gives error in seaborn 0.11 #2263

Maltimore opened this issue Sep 9, 2020 · 3 comments · Fixed by #2386

Comments

@Maltimore
Copy link

I updated to seaborn 0.11 and get an error with code that did not even give a warning with seaborn 0.10.

I have a pandas DataFrame with hierarchical columns. That means that I reference a column like so:

df[('0th_order_col_name', '1st_order_col_name')]

When I try to specify such a hierarchical column label in, for instance, a scatterplot, seaborn now gives me an error because it tries to interpret this hierarchical column label as data.

sns.scatterplot(x=('0th_order_col_name', '1st_order_col_name_FOO'), y=('0th_order_col_name', '1st_order_col_name_BAR'), data=df)

The error message is

ValueError: Length of tuple vectors must match length of `data` when both are used, but `data` has length 5 and the vector passed to `x` has length 2.

The change was introduced in #2205

@mwaskom
Copy link
Owner

mwaskom commented Sep 9, 2020

I don't think this was intentionally supported to begin with, and I'm a little surprised that it did.

@Maltimore
Copy link
Author

Are you planning to support this in the future then, or should I close this issue?

@mwaskom
Copy link
Owner

mwaskom commented Sep 10, 2020

Hierarchical columns add a lot of complexity. They're not "tidy", strictly speaking. My inclination would be to say that they're not supported, because it was never claimed that they were. But it does look like they worked, accidentally, in more places than I realized. So I can look into how disruptive it would be to handle them in the refactored code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants