I have a dataframe in the following format:
| Index | Object1-Length | Object1-Height | Object2-Length | Object2-Height |
|---|---|---|---|---|
| 0 | 19 | 49 | 21 | 52 |
| 1 | 20 | 50 | 21 | 51 |
| 2 | 20 | 51 | 20 | 52 |
| 3 | 19 | 50 | 19 | 52 |
| 4 | 20 | 50 | 20 | 52 |
It continues with Object3, Object4 and so on...
I want to check two columns at the same time in the following way:
if ObjectX-Length >= 20 and ObjectX-Height >= 50
then set both cells of ObjectX to 1, else set them to 0
So this is the table I want:
| Index | Object1-Length | Object1-Height | Object2-Length | Object2-Height |
|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 1 |
| 1 | 1 | 1 | 1 | 1 |
| 2 | 1 | 1 | 1 | 1 |
| 3 | 0 | 0 | 0 | 0 |
| 4 | 1 | 1 | 1 | 1 |
Is there any way to do this?
EDIT: Combining both columns of each object into one column and setting that cell to 0 or 1 would also work!