Probably the most elegant solution (but certainly not the most efficient):
for row in df.values:
c2 = row[1]
print(row)
# ...
for c1, c2 in df.values:
# ...
Note that:
- the documentationthe documentation explicitly recommends to use
.to_numpy()instead - the produced NumPy array will have a dtype that fits all columns, in the worst case
object - there are good reasons not to use a loop in the first place
Still, I think this option should be included here, as a straight-forwardstraightforward solution to a (one should think) trivial problem.