Q:

TypeError: string indices must be integers with pandas dataframe

I want to compare 2 dataframe rows to eachother.  When I try to run my code I get this error:
TypeError: string indices must be integers. 
this is my code:
for item in df:
    if item["comment text"] ! = item["original text"]:
        counter1 += 1

thanks in advance. 

A:

You need to use the iterrows() function to iterate through a Pandas DataFrame
for index,item in data.iterrows():
    if item["comment text"] ! = item["original text"]:
        counter1 += 1

