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

BUG: Compatibility Issues of Numpy Methods with pd.NA in Styler.bar #56425

Open
ccccjone opened this issue Dec 9, 2023 · 0 comments
Open

BUG: Compatibility Issues of Numpy Methods with pd.NA in Styler.bar #56425

ccccjone opened this issue Dec 9, 2023 · 0 comments

Comments

@ccccjone
Copy link
Contributor

ccccjone commented Dec 9, 2023

In PR #56341 , we've identified a compatibility issue in Styler.bar where numpy methods fail to properly handle pd.NA.

Related comment as below:
Then the next question is what are the other uses of values. In the code below you will observe the function np.nanmean(values). Does this mean your fix will not work when align="mean"? Or if align is callable?
values is also used when there is a cmap.

Originally posted by @attack68 in #56341 (review)

To demonstrate the problem, I have prepared a code snippet and screenshots showing the error caused by align='mean'. I believe a detailed examination of the compatibility of numpy methods with pd.NA in Styler.bar is needed.

import pandas as pd
df = pd.DataFrame({"A":[1, 2, pd.NA, 4]})
df.style.bar(subset="A", align="mean")
Screen Shot 2023-12-09 at 03 01 53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant