using this as a demo data set:
a = [['11', '2'], ['15', '70'], ['8', '5']]
df = pd.DataFrame(a, columns=['Person','one', 'two'])
Out[8]:
Person one two
0 Jim 10 1.2
1 John 15 70
2 Bob 8 5
I want to create some sort of logic calculation to compare only columns' one and two, comparing both of them and outputting a new column with the results
a calculation like this if column one is > column two put a 1 else 0
Desired output:
Out[8]:
Person one two Results
0 Jim 10 1.2 1
1 John 15 70 0
2 Bob 8 5 1
Aucun commentaire:
Enregistrer un commentaire