Jul-17-2019, 04:44 PM
Hi all,
I have a data frame that has 5 columns named as '0','1','2','3','4'
I want to use row-wise the input above to feed a function that does the following. I give as example for the first and second row
firstrow:
secondrow:
for the third row onwards and then assign all those results as an extra column.
I have heard about lambda function that can work row-wise but I am not sure how to implement one.
Can you please advice me?
Thanks a lot
Alex
I have a data frame that has 5 columns named as '0','1','2','3','4'
1 2 3 4 5 6 7 |
small_pd Out[ 53 ]: 0 1 2 3 4 0 93.0 94.0 93.0 33.0 0.0 1 92.0 94.0 92.0 33.0 0.0 2 92.0 93.0 92.0 33.0 0.0 3 92.0 94.0 20.0 33.0 76.0 |
firstrow:
1 |
takeValue[ 93 ] - takeValue[ 94 ] + takeValue[ 93 ] - takeValue[ 33 ] + takeValue[ 0 ] |
1 |
takeValue[ 92 ] - takeValue[ 94 ] + takeValue[ 92 ] - takeValue[ 33 ] + takeValue[ 0 ] |
I have heard about lambda function that can work row-wise but I am not sure how to implement one.
Can you please advice me?
Thanks a lot
Alex