-
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
size
parameter of scatterplot
does not accept Float64 type
#3519
Comments
To clarify, the important distinction is not between 32/64 bit precision, but between float/Float, where the latter is the pandas-specific dtype rather than a dtype that also exists in numpy. |
Some additional detail that we just found...
but this one does not:
There is a hard threshold between plotting 6 and 7 points where this error starts. |
That makes sense, the error is being raised from matplotlib ticker code that is producing the “brief” legend values. Ultimately the pandas dtypes are an ongoing annoyance for seaborn. They’re still “experimental” in pandas and often cause issues in code written expecting numpy dtypes, which is most of matplotlib. Seaborn can try to cast data types and handle specific cases where they arise but there’s not a great general solution. |
@mwaskom would the recommendation be to use numpy data types in the meantime? Are you aware of any notes in matplotlib with a similar recommendation? |
Yes, your issue is with the |
I tried using astype function to convert the dataframe dtypes to float64 and it seems to work for more than the threshold of 7 rows.
However, convert_dtypes() usage results in the error. |
Right, |
I'm sorry that you have been experiencing this downstream, but I'm also not surprised. I have made a PDEP in pandas to align on a Logical Type System that I think could help, and would love any feedback on to improve this experience for the ecosystem:
This is another area I am hoping we can address via the PDEP process: pandas-dev/pandas#59125 (comment) These "experimental" types have existed since 2019 with little updates on the pandas side, so the experimental label is disingenuous at this point |
Create a table that has dtypes Float64 and use one of the columns for the
size
parameter inscatterplot
:Running that code produces the following error:
If you omit the
size
parameter or explicitly convert the types to float32, it works, e.g.:Does seaborn not support Float64 type?
The text was updated successfully, but these errors were encountered: