I have a data frame that looks like this:
and I want to loop through each row and print the [i,j] position of a non-NaN entry. here, the loop would ideally print "G56" and "G51".
So far I have created a T/F data frame that records all non-NaNs as True:
df_na = df.notnull()
and I can get the row index for any Trues:
for index, row in df_na.iterrows():
if row.any() == True:
print(index)
but I can't get the column name. (I'm also concerned with this approach since iterrows() is slower than itertuples().
