I encountered the error
\'>\' not supported between instances of \'str\' and \'int\'
while trying to print the below lines in P
This message suggests, that you try to compare a string object (str
) with an integer (int
).
The expression
survey_df_clean['text']
will probably return a string. Therefore, you cannot directly compare it with the number 30
. If you want to compare the length of the entry, you can use the pandas.Series.str.len()
operation as you can see here.
If this field should actuallty contain an integer, you can use this method (pandas.to_numeric
) to cast it from str
to int
.