[False, False] Length: 2, dtype: boolean In [12]: a.any() Out[1...">

BUG: BooleanArray.any with all False values and skipna=False is buggy · Issue #33253 · pandas-dev/pandas (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@jorisvandenbossche

Description

@jorisvandenbossche

From a report on my blog, this seems buggy:

In [10]: a = pd.array([False, False], dtype="boolean")  

In [11]: a  
Out[11]: 
<BooleanArray>
[False, False]
Length: 2, dtype: boolean

In [12]: a.any() 
Out[12]: False

In [13]: a.any(skipna=False)   
Out[13]: <NA>

I don't think there is a reason to return NA if there are no NAs in the array? (even with skipna=False)

We probably need to do a check for the presence of any NA here in the else clause:

if skipna:
return result
else:
if result or len(self) == 0:
return result
else:
return self.dtype.na_value