I have the following Pandas DataFrame:
(My original DataFrame is a lot bigger than the one in this example.)
I need to add another column (col3) to this DataFrame and values of col3 will be set based on following conditions:
- If col1 > col2, value of col3 will be set to 0 on that row.
- If col1 == col2, value of col3 will be set to 1 on that row.
- If col1 < col2, value of col3 will be set to 2 on that row.
The above DataFrame will look as the following after this operation:
Is there a way to do this without looping through the DataFrame?

