Currently I am trying to iterate through a data frame, compare each value in a list of strings with the value in a certain column in the data frame. If this is comparison is true, then append the values from a different column of the same row to a separate list.
list_of_words = 'yes', 'no', 'maybe'
appendList = []
for word in list_of_words:
for row in dataframe1.iterrows():
if row['A'] == word:
appendList.append(row['B'])
return appendList
The issue is I am unsure how to compare the value in the list with the column value. I am quite new to pandas and python in general but so far the convenience methods have been great. Just unsure how to work this to return what I need. Any help or advice to any docs that would help would be appreciated!