Filling in Missing Date Values (tidyjs or otherwise)

I try to use tidyjs to complete a date sequence and it correctly fills in the missing data (yay!), but I end up overwriting the rest of the data (boo!)

Do you have a good idea (in tidyjs or otherwise) for filling in missing date data while retaining the existing data values?

1 Like

That’s odd, as doing it long hand with expand, leftJoin also fails the Close

I guess loDash could fix it

  let td = T.tidy(
    aaplMissing,["Date", "Close"]),
    T.complete({Date: T.fullSeqDate('Date', 'day', 1)}, {Close: 0})

  return (d) => {
    let where = _.findIndex(aaplMissing, {Date: d.Date} )
    return {Date:d.Date, Close: (where == -1)?0:aaplMissing[where].Close}

Yeap, ugly code :smiley:

Cool that works, but I agree it’s annoying that it is a little unruly, having to go back and match up against the indices of the original data. Surprised that the tidyjs method can’t handle it (at least how I approached it).

I’m coming from R, so tidyjs was approachable, bu I wonder if anyone has experience doing this sort of thing in Arquero.

1 Like

I think it is a bug in tidyJS as all the docs say it should work as advertised.

Arquero might do it but I have not used it.

I’ll see if I can submit an issue about tidyjs. Thanks for your help!

1 Like