Skip to content
Advertisement

How to apply function vertically in df

I want to add column values vertically from top to down

JavaScript

I tried using apply but its not working

Desired output is basically adding A column values 1+2, 2+3:

JavaScript

Advertisement

Answer

You can apply rolling.sum on a moving window of size 2:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement