Wondering about something small in an iteration

Screen Link:

https://app.dataquest.io/m/433/guided-project%3A-building-a-spam-filter-with-naive-bayes/9/measuring-the-spam-filters-accuracy

My Code:

total = test_set.shape[0]
    
for row in test_set.iterrows():
    row = row[1]
    if row['Label'] == row['predicted']:
        correct += 1

Hi, I fully understand pretty much everything that is going on here. I am just slightly confused with regards to the line:

“row = row[1]”

At first I ran my code without this line and it did not work. I was wondering what this line of code does in terms of the iteration and why it is necessary? I also don’t fully understand how we could use this notation as it refers to a specific row doesn’t it? I think I am missing something :slight_smile:

Is it possibly because we are not wanting to include the row with the column titles?

Thanks in advance!

John

I think my answer here - Guided Project: Building a Spam Filter with Naive Bayes itterows()? should clarify this for you.