I have a DataFrame like so:
a = date | user | value
-------------------------
2017-05-01 | AAA | 1
2017-05-02 | AAA | 2
... | AAA | ...
2017-08-31 | AAA | 1.7
2017-05-01 | BBB | 1.5
2017-05-02 | BBB | 3
... | BBB | ...
2017-08-31 | BBB | 2.7
Additionally, I have a list like so:
b = start_date | user
-----------------
2017-05-02 | AAA
2017-05-05 | AAA
2017-05-03 | BBB
I now want to extract a 3-dimensional matrix from a that contains a list of the 3 next dates starting from the start_date given in b for the user given in b. So in the above example the following:
[
[[2017-05-02, AAA, 2], [2017-05-03, AAA, x], [2017-05-04, AAA, x]],
[[2017-05-05, AAA, 2], [2017-05-06, AAA, x], [2017-05-07, AAA, x]],
[[2017-05-03, BBB, 2], [2017-05-04, BBB, x], [2017-05-05, BBB, x]],
]
x stands for a random value, I was just too lazy to type all examples down.
I am using Python 3.5. Thanks a whole lot in advance. I am looking forward to your smart answers :-)