ENH: Restore the functionality of .fillna
#59831
Labels
Dtype Conversions
Unexpected or buggy dtype conversions
Enhancement
Missing-data
np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Needs Discussion
Requires discussion from core team before further action
Needs Info
Clarification about behavior needed to assess issue
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
The currently very useful behaviour of
.fillna
is being deprecated.Using
a.fillna
raises a warning:Full message of the warning is:
The proposed solutions don't work:
maybe I misunderstood the Warning message?
Let's try to opt-in...
No, it's no longer a
bool
Series...Some online resources suggest first casting to
bool
...Looks like this is a potential replacement for
.fillna(False)
but not for.fillna(True)
...Wait, there's a
downcast
parameter for.fillna
!Oh no, it's deprecated as well, not I got TWO warnings...
Feature Description
Restore the functionality of
.fillna
WITHOUT the Warning.Alternative Solutions
Currently, the only "correct" option is to use nullable Boolean type.
This is overly verbose, but would be acceptable if
boolean
was inferred automatically for[True, False, None]
(or[True, False, np.nan]
), but currently it's not...(The additional confusion is that integer nullable types are distinguished by uppercase (
int64 -> Int64
) but boolean nullable type isn't (bool -> boolean
)... so it took me a very long time to even find this solution!)Additional Context
No response
The text was updated successfully, but these errors were encountered: