I have a Dataframe as below that contains string and NaN value

I’m creating a for loop to loop through each value. How do I call/extract just the value of the cell in the loop.

Example : for idx in df.index: for i in range(14): x = first row, "Sentence" column which is equal to the string "If your genetic..." (idx is 1 and i is 0) y = first row, "First" column which is equal to "10|||the" (idx is 1 and i is 1) DataFrame : Sentence First Second Third Fourth Fifth Sixth Seventh Eighth Nineth tenth eleventh twelveth thirteen S 1 If your genetic... 10|||the 26|||will NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN Loop : for idx in df.index: for i in range(14):

## Answer

If you want to iterate through each i,j value of the data frame, you can do something like this:

for i in range(df.shape[0]): for j in range(df.shape[1]): print(df.iloc[i, j])