LabelEncoder Error: ‘>’ not supported between instances of ‘str’ and ‘float’ Posted On November 2, 2017 Issue: When using LabelEcoder for the column with values like “02 – ABC’, it was throwing error: TypeError: ‘>’ not supported between instances of ‘str’ and ‘float’ Code used: Error msg: Solution: Its most likely related to the definition of an object type in pandas, object type does not necessarily mean dtype str. and pandas forces the type to change when it inserts NaN values please use .astype(str) to solve the error Thank You Related Add a Comment Cancel reply Your email address will not be published. Required fields are marked *comment Notify me of follow-up comments by email. Notify me of new posts by email. This site uses Akismet to reduce spam. Learn how your comment data is processed.