ibis-project / ibis

the portable Python dataframe library
https://ibis-project.org
Apache License 2.0
4.36k stars 540 forks source link

Feature Request: Forward and Backward Fill like in Pandas API #3652

Closed pybokeh closed 2 years ago

pybokeh commented 2 years ago

I'm sure there is probably a way to do this using native ibis API which I'm guessing will be a bit more verbose compared to a one-liner functionality that is available in Pandas API.

gforsyth commented 2 years ago

Hey @pybokeh -- I wrote up a short wiki page with an example of using bfill and ffill using window functions: https://github.com/ibis-project/ibis/wiki/ffill-and-bfill-using-window-functions

contang0 commented 3 weeks ago

The document by @gforsyth is certainly very helpful, but in the end it is a workaround.

It would be nice if we could simply call bfill/ffill on a column like we do in pandas. I ran into this issue while working with lag function. The column it creates has values for every 2nd row, but I want to also backfill the nulls.

p.s. is it okay to comment on closed issued? Is it preferable to create new ones?

pybokeh commented 2 weeks ago

I agree. I was hoping it would be less verbose or similar to pandas. There is an open issue on handling of Nulls in window function: https://github.com/ibis-project/ibis/issues/7649 which should simplify things, but not sure what the final syntax would look like afterwards for ffill/bfill.