You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In an older version of pandas (before pandas commit pandas-dev/pandas@b2d54d9), when filter_array_like saw a pd.NA in the context of a pandas BooleanArray, it treated it as a False. In newer versions (after pandas-dev/pandas@b2d54d9), the pd.NA is treated as pd.NA, which when casting to a numpy array causes an error.
This relates to the pandas issue: pandas-dev/pandas#45249 which is actually a new behavioral change and not a BUG. The old functionality of treating pd.NA as False was a bug actually.
Example code (ideally copy-pastable)
Please provide a minimal reproducible code example to reproduce the behavior,
I have a hacky patch in filter_array_like that looks like:
with np.errstate(invalid="ignore"):
if op == "==":
if pd.isnull(value):
np.logical_and(pd.isnull(array_like), mask, out=out)
else:
res_eq = array_like == value
np.logical_and(res_eq.fillna(False), mask, out=out)
basically filling in any NA with False during the comparison before giving it up to np.logical_and
Problem description
In an older version of pandas (before pandas commit pandas-dev/pandas@b2d54d9), when
filter_array_like
saw a pd.NA in the context of a pandas BooleanArray, it treated it as a False. In newer versions (after pandas-dev/pandas@b2d54d9), the pd.NA is treated as pd.NA, which when casting to a numpy array causes an error.This relates to the pandas issue: pandas-dev/pandas#45249 which is actually a new behavioral change and not a BUG. The old functionality of treating pd.NA as False was a bug actually.
Example code (ideally copy-pastable)
Please provide a minimal reproducible code example to reproduce the behavior,
Used versions
The text was updated successfully, but these errors were encountered: