-
Notifications
You must be signed in to change notification settings - Fork 179
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Spotted that I never followed up on (#3031 (comment)), (#3031 (comment)).
I think we can make this easier by introducing
drop_nans, aligning our support of{drop,fill}_{nans,nulls}
narwhals/docs/concepts/null_handling.md
Lines 12 to 26 in 8d93fb1
| ## What's the difference? | |
| Most data tools except pandas make a clear distinction between: | |
| - Null values, representing missing data. | |
| - NaN values, resulting from "illegal" mathematical operations like `0/0`. | |
| In Narwhals, this is reflected in separate methods for Null/NaN values: | |
| | Operation | Null | NaN | | |
| | --------- | --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | |
| | is | [`Expr.is_null`][narwhals.Expr.is_null] | [`Expr.is_nan`][narwhals.Expr.is_nan] | | |
| | fill | [`Expr.fill_null`][narwhals.Expr.fill_null] | [`Expr.fill_nan`][narwhals.Expr.fill_nan] | | |
| | drop | [`Expr.drop_nulls`][narwhals.Expr.drop_nulls] | *Not yet implemented (See [discussion](https://github.com/narwhals-dev/narwhals/issues/3031#issuecomment-3219910366))*<br>[`polars.Expr.drop_nans`](https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.drop_nans.html) | | |
| | count | [`Expr.null_count`][narwhals.Expr.null_count] | *No upstream equivalent* | |
The *Frame-level variants seem the most useful for lazy backends, to avoid issues with checking for NaN against a non-float
Related
- https://docs.pola.rs/api/python/stable/reference/dataframe/api/polars.DataFrame.drop_nans.html
- https://docs.pola.rs/api/python/stable/reference/lazyframe/api/polars.LazyFrame.drop_nans.html
- https://docs.pola.rs/api/python/stable/reference/series/api/polars.Series.drop_nans.html
- https://docs.pola.rs/api/python/stable/reference/expressions/api/polars.Expr.drop_nans.html
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request