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 https://github.com/pandas-dev/pandas/pull/56341#pullrequestreview-1773629306

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