I have a table that looks like this:
+---------------+------+-----------+
| EffectiveDate | TSV | MTDReturn |
+===============+======+===========+
| '1994-01-30' | 100 | 0.04 |
+---------------+------+-----------+
| '1995-02-28' | None | 0.02 |
+---------------+------+-----------+
| '1992-03-31' | None | 0.01 |
+---------------+------+-----------+
| '1974-08-30' | None | 0.06 |
+---------------+------+-----------+
I'm using the PETL
library to try and populate the TSV
value. I'm able to do this by breaking the table down into a list of dicts and manipulating it, but I was asked to do it using PETL
only.
The formula is pretty straight forward: TSV = previousTSV * (1 + MTDReturn)
I have looked into aggregation
but there's nothing to group them by.
Perhaps I could join a table that has a column with previousTSV
?