I have a dataframe df().
Furthermore I have a certain value x.
Now I would like to examine three conditions whether there is a column or not:
1) if df[i] >= x : yes
2) if df[i-1] >= df[i] and df[i] >= x:yes
3) df[i+1] >= df[i] and df[i] >= x: yes
Here, 1) is the basic assumption. Other conditions are to be based on it. I tried to do this with a ifelse()function.
ifelse(df <= x,
ifelse(df[i-1] <= df[i] , <column>, <no>),
ifelse(df[i+1] <= df[i], <column>, <no>))
But it doesn't work. Do you have any idea how to solve the problem ?
Thanks
Aucun commentaire:
Enregistrer un commentaire