I try to modify the value of cells in a dataframe, conditionnal to their value. the dataframe dataTrad(50k, 20) as 21 columns, one of which is called 'reindex'. I want to bring the value of any 'reindex' cell down to 0 as soon as its original value is lower than a variable (mlp).
I tried : dataTrad[i, 'reindex'][dataTrad[i, 'reindex'] < mlp] = 0
with a loop on i with the range(len(dataTrad)),
as well as dataTrad.loc[(dataTrad.reindex < malp),'reindex']=0
, but none of these two methods worked.
In my precise example, I had mlp = 60 len(dataTrad) = 57830
What do I do wrong, and how could I solve this ? Thanks a lot in advance.