New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gap filling: fill previous? #480

Open
est opened this Issue Mar 26, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@est

est commented Mar 26, 2018

Taken from the gap filling doc

    date    | volume
------------+--------
 2017-09-30 |      0
 2017-09-29 |  11315
 2017-09-28 |   8216
 2017-09-27 |   5591
 2017-09-26 |   9182
 2017-09-25 |  14359
 2017-09-24 |      0
 2017-09-23 |      0
 2017-09-22 |   9855

http://docs.timescale.com/v0.9/using-timescaledb/reading-data#gap-filling

Now I dont want to fill(0), I need fill(previous) like this:

    date    | volume
------------+--------
 2017-09-30 |      0
 2017-09-29 |  11315
 2017-09-28 |   8216
 2017-09-27 |   5591
 2017-09-26 |   9182
 2017-09-25 |  14359
 2017-09-24 |  14359
 2017-09-23 |  14359
 2017-09-22 |   9855

How can this be done?

@est

This comment has been minimized.

Show comment
Hide comment
@est

est Mar 26, 2018

I found this clever windowing function hack

https://stackoverflow.com/a/19012333/41948

est commented Mar 26, 2018

I found this clever windowing function hack

https://stackoverflow.com/a/19012333/41948

@cevian

This comment has been minimized.

Show comment
Hide comment
@cevian

cevian Mar 26, 2018

Contributor

We plan to improve this functionality shortly, but for now you can use the method here: https://www.joyofdata.de/blog/locf-linear-imputation-postgresql-tutorial/

Contributor

cevian commented Mar 26, 2018

We plan to improve this functionality shortly, but for now you can use the method here: https://www.joyofdata.de/blog/locf-linear-imputation-postgresql-tutorial/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment