TypeError: '>' not supported between instances of 'str' and 'float'

You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

Hi ! I’m currently want to filter the third columns of a csv file. So there are multiple rows as header? So I combined them into one header.

Then I want to filter the third column, the error message showed up said that ‘str’ and ‘float’.

I don’t know how to fix this.

Do you have a link to the lesson?

Also, did you do a:

to check the data types of the columns in the dataframe?

You cannot compare a string to a float. You would have to look at the data types and the data in the columns affected and then change the data type accordingly.

1 Like