Wednesday 31 July 2019

TypeError: unorderable types: str() < int()

Error when executing

# TODO
peopleWithFixedSalaries20KDF = peopleWithFixedSalariesDF.filter("salary" <20000).limit(10)


TypeError: unorderable types: str() < int()
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <command-3332536293827326> in <module>() 1 # TODO ----> 2 peopleWithFixedSalaries20KDF = peopleWithFixedSalariesDF.filter("salary" <20000).limit(10) TypeError: unorderable types: str() < int()


solution is

# TODO peopleWithFixedSalaries20KDF = peopleWithFixedSalariesDF.filter(col("salary") <20000).limit(10)

or

# TODO

peopleWithFixedSalaries20KDF = peopleWithFixedSalariesDF.filter("salary <20000").limit(10)

instead.


No comments:

Post a Comment