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
Is your feature request related to a problem or challenge?
There is a common operation in libraries such as PySpark to fill NaN values across an entire DataFrame (or limit by columns). It would be useful to have a similar feature in DataFusion and datafusion-python.
Describe the solution you'd like
If I have a dataframe with a bunch of null values in different columns, I would want to replace all NaNs in those columns with the provided value IF it can be cast to the column's type. Otherwise no-op should happen. Also the user should be able to limit which columns this applies to.
A possible implementation is to design a bunch of fill UDFs, such as fill_value, fill_prev, fill_linear etc, which act on a column expression in the select list.
The users can then use SELECT fill_value(a, 1.0), fill_prev(b) FROM table to fill selected columns with available fill strategies.
Or use DataFrame::new(..).fill(vec![(Column, FillStrategy), (Column, FillStrategy)]) to apply filling on specified columns of a data frame.
fill_null already landed in #14769. And most dataframe libs (polars, pandas) keep fill_null and fill_nan as separate methods. So I'd add fill_nan in the same style to stay consistent.
Activity
niebayes commentedon Feb 19, 2025
A possible implementation is to design a bunch of fill UDFs, such as fill_value, fill_prev, fill_linear etc, which act on a column expression in the select list.
The users can then use
SELECT fill_value(a, 1.0), fill_prev(b) FROM tableto fill selected columns with available fill strategies.Or use
DataFrame::new(..).fill(vec![(Column, FillStrategy), (Column, FillStrategy)])to apply filling on specified columns of a data frame.Nagato-Yuzuru commentedon Jun 1, 2026
I'd like to take this.
fill_nullalready landed in #14769. And most dataframe libs (polars, pandas) keepfill_nullandfill_nanas separate methods. So I'd addfill_nanin the same style to stay consistent.Nagato-Yuzuru commentedon Jun 1, 2026
take
feat: add DataFrame fill_nan (apache#22702)