vendredi 14 septembre 2018

if else condition on rows of the columns

Applying the logic as below:

constant = 5

if count <= constant, print rows from value 1[1:5], once count > constant, print rows from value 2[1:5].

not using indexing - slicing, need a logic, as constant can be changed in future.

Expected output:

count  value_1    value_2     output
1   0.001138636 0.081404856 0.001138636
2   0.001157974 0.089056417 0.001157974
3   0.00117294  0.098103887 0.00117294
4   0.00124517  0.109297111 0.00124517
5   0.001369958 0.123153932 0.001369958
6   0.001494746 0.141047465 0.081404856
7   0.001619535 0.165075631 0.089056417
8   0.001744323 0.198308568 0.098103887
9   0.001771541 0.248464171 0.109297111
10  0.001713549 0.331921807 0.123153932

Aucun commentaire:

Enregistrer un commentaire