I have a Dataframe that looks like this.
done sentence 3_tags
0 0 ['What', 'were', 'the', '...] ['WP', 'VBD', 'DT']
1 0 ['What', 'was', 'the', '...] ['WP', 'VBD', 'DT']
2 0 ['Why', 'did', 'John', '...] ['WP', 'VBD', 'NN']
...
For each row I want to check if the list in column '3_tags' is on a list temp1, as follows:
a = pd.read_csv('sentences.csv')
temp1 = [ ['WP', 'VBD', 'DT'], ['WRB', 'JJ', 'VBZ'], ['WP', 'VBD', 'DT'] ]
q = a['3_tags']
q in temp1
For the first sentence in row 0, the value of '3_tags' = ['WP', 'VBD', 'DT'] which is in temp1 so I expect the result of the above to be:
True
However, I get this error:
ValueError: Arrays were different lengths: 1 vs 3
I suspect that there is some problem with the datatype of q:
print(type(q))
<class 'pandas.core.series.Series'>
Is the problem that q is a Series and temp1 contains lists? What should I do to get the logical result 'True' ?