Closed eromoe closed 1 week ago
PS: fill_nan works, however cost my 1 hour to dig this problem .
NaN is a floating point value NotANumber which is not the same as null/none.
You are dividing by 0, resulting in a NaN value. NaN is not a null (missing) value. Being able to differentiate between null values and NaN values is super useful.
Would it be worthwhile adding a note/warning to the fill_null docs?
Or maybe linking to the user guide?
The assumption that fill_null will work on NaN has popped up a few times.
@ritchie46 pandas only have method fillna
, and other functions like notnull
,isnull
also check the value is nan of not .
That's because pandas mixes floating point NaN
and missing values.
We don't follow pandas. It is not correct on this matter.
@ritchie46 I think it better to warn this in docs at least , because many people come from pandas would easily make mistakes .
Checks
Reproducible example
Log output
No response
Issue description
I find
fill_null
doesn't supoort fill by another col PS:fill_nan
works, however cost my 1 hour to dig this problem .Here in docs https://docs.pola.rs/py-polars/html/reference/dataframe/api/polars.DataFrame.fill_null.html
Expected behavior
Type annotation is
Any
, I think it should support fill by exprInstalled versions