Iterating Through Iterrows
iterrows can be used to iterate through a pandas dataframe: for row in df.iterrows(): print(row) How can I use a second for loop to iterate through each element in the row?
Solution 1:
iterrows returns a tuple. The element indexed by [1] contains the row. You can then iterate through that element.
for row in x.iterrows():
print(row[1])
for b in row[1]:
print(b)
Post a Comment for "Iterating Through Iterrows"