Tich Mangono
1 min readSep 9, 2019

--

Thank you Daniel, that’s what I thought as well but its not quite as straight forward. If you just group and shift like that you risk doing things to your that you did not intend to do e.g. it may shift the wrong dates and ends up with the wrong output because shift works a little different from other group functions like sum() or mean() which are many-to-one functions. Whereas shift() is a many-to-many function and things get weird very quickly. This is why I decided to show the more comprehensive methods above. However, let me know if you actually got the same results dataframe that I got in part 2 and part 3 by using the method you suggest.

--

--

Tich Mangono
Tich Mangono

Written by Tich Mangono

Passionate about public health, python, machine learning, and data science. I also share my ideas on https://tichmangono.github.io/

No responses yet