Can I use numpy broadcasting to achieve one column (col + 1) subtraction with other column (col -1) and dividing them by constant (n).
arr = [[2, 4, 6, 5, 8],
[5, 3, 7, 4, 4],
[3, 9, 5, 2, 1]]
result = [
[ 2, # (6 - 2)/2
.5, # (5 - 4)/2
1, # (8 - 6)/2
],
[ 1, # (7 - 5)/2
.5, # (4 - 3)/2
-1.5 # (4 - 7)/2
],
[ 1, # (5 - 3)/2
-3.5, # (2 - 9)/2
-2 # (1 - 5)/2
]
]
Or what is the efficient way to achieve it on GBs of data?