-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Seaborn plots do not work with latest pandas settings (copy-on-write) #3331
Comments
To be clear, by "next version of pandas" you mean next major version, i.e. 3.0, right? |
Yes that's right, sorry for the ambiguity. Pandas 3.0 is probably a long way off; my point was just that CoW seems to be the broad direction of travel for pandas, and so users are increasingly likely to have this setting enabled globally. |
Yeah I'm fine with that, although it looks like right now the story about pandas <> numpy with CoW is a little bit unsettled (numpy/numpy#23625) and I might wait for the dust to settle there... |
I don't recall intentionally changing anything in seaborn to support copy-on-write. Therefore I expect the relevant change was in |
I think it's safe to close this given the above. Also interesting that nobody else has chimed in with other issues. Please continue testing seaborn with |
My guess is that this was indirectly fixed by #3440 The seaborn/seaborn/distributions.py Line 473 in b95d6d1
And then there are some transformations done on it: seaborn/seaborn/distributions.py Lines 485 to 493 in b95d6d1
Before the aforementioned PR (and in case of no log scale), the first edit to |
On the actual topic of testing seaborn with CoW: I did a test run locally and only got one error, but which happened without enabling CoW as well, which is a bug in pandas (pandas-dev/pandas#57276). So it seems that it is currently all good (at least based on the test suite ;)). There are also no warnings about behaviour changes (eg chained assignment will stop working). |
That sounds like the same failure I saw, glad my intuitions were correct :) Having a build in the test matrix that uses copy-on-write makes sense, thanks! |
Summary
Some seaborn plots throw a
ValueError
depending on the users's global pandas configuration.Pandas 1.5 introduced a feature called Copy-On-Write (CoW), which aims to lead to more predictable and performant behaviour. CoW is currently an optional setting, which can be controlled with
pd.set_option
(see example below).However, CoW it is expected to become the default behaviour in the next version of pandas, and as of the recent launch of pandas v2 it is prominently recommended in the pandas docs . So, I think it is important for seaborn plots work with this setting enabled.
Minimal example
Results in error:
Versions
0.12.2
3.7.1
2.0.0
1.23.5
[EDIT: updated example to give full error output]
The text was updated successfully, but these errors were encountered: