I have a pandas Dataframe, where I have to compare values of two adjacent rows of a particular column and if they are equal then in a new column 0 needs to be added in the corresponding first row or 1 if the value in the second row is greater than the first or -1 if it's smaller. For example, such an operation on the following Dataframe dataframe before the operation
column1
0 2
1 2
2 4
3 4
4 5
5 3
6 2
7 1
8 55
9 3
should give the following output
column1 column2
0 2 0
1 2 1
2 4 0
3 4 1
4 5 -1
5 3 -1
6 2 -1
7 1 1
8 55 -1
9 3 0