C
C#6mo ago
Tandy

Fill in missing dates in list?

For simplicity, suppose I have a list of nullable dates, and I need to reverse engineer the dates that are missing. The tricky thing is that it's not simply filling in between the first date and the last date, but the data can be monthly, quarterly, etc, and so the list of dates is not consistent. so something like [2022-10-03, null, null, 2022-12-31, null, null, 2023-03-31] should be filled in with monthly data like [2022-10-03, 2022-10-31, 2022-11-30, 2022-12-30, 2023-01-31, 2023-02-28, 2023-03-31] but there could be cases where the first few items in the array are empty, or the gaps between data is smaller, etc. I don't need an answer just need a nudge in the right direction. There's currently a solution in place for this but it's difficult to follow and there are a few bugs that would probably be fixed by an alternative, more robust solution
1 Reply
ACiDCA7
ACiDCA76mo ago
is there a known list of choices or can it be anything? anyway, i would go with probabilities.. eg analyze the data how many days are between each entries, if there are nulls in between divide it. then select of a set of available modes that is closest then maybe also check how many of the dates are end of month or on a specific weekday. then use these as modifiers.. etc
Want results from more Discord servers?
Add your server