I need help creating a new column on my dataframe
I have the following dataframe:
OPEN CLOSE
1 1.10074 1.10073
2 1.10073 1.10083
3 1.10083 1.10082
4 1.10082 1.10070
5 1.10071 1.10073
6 1.10073 1.10083
7 1.10083 1.10083
8 1.10083 1.10086
9 1.10088 1.10073
10 1.10073 1.10075
I would like to tag the values ββin the 'CLOSE' column whenever greater or less than the previous
example exit:
OPEN CLOSE TAG
1 1.10074 1.10073 ? #anything can be placed
2 1.10073 1.10083 1 #value higher than previous
3 1.10083 1.10082 0
4 1.10082 1.10070 0
5 1.10071 1.10073 1 #value higher than previous
6 1.10073 1.10083 1 #value higher than previous
7 1.10083 1.10083 ? #when equal anything can be placed
8 1.10083 1.10086 1 #value higher than previous
9 1.10088 1.10073 0
10 1.10073 1.10075 1 #value higher than previous
what would be the best way to do this? I tried with enumerate but I couldn't. Thank you for your help.