Skip to content
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

Closed
est opened this issue Mar 26, 2018 · 5 comments
Closed

gap filling: fill previous? #480

est opened this issue Mar 26, 2018 · 5 comments

Comments

@est
Copy link

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
Copy link
Author

est commented Mar 26, 2018

I found this clever windowing function hack

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

@cevian
Copy link
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/

@mfreed
Copy link
Member

mfreed commented Feb 7, 2019

@est This capability can now be found using our time_bucket_gapfill and locf functionality, first released in version 1.2.

https://docs.timescale.com/v1.2/api#locf

@mfreed mfreed closed this as completed Feb 7, 2019
@est
Copy link
Author

est commented Feb 8, 2019

@mfreed thanks!

@slidenerd
Copy link

slidenerd commented Feb 22, 2019

  • Instead of using any form of averaging or previous value substitution, I am querying the external API to update the missing data by detecting gaps with a task queue

  • If I had say 1 million 1m data points and I wanted 5m data points from it, do I have to run over the whole database again or just the latest chunk

  • Are the older chunks updatable to fill missing data because it may take some time with a task queue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants