close

[Solved] TypeError: object of type ‘float’ has no len()

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error TypeError: object of type ‘float’ has no len() in python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How TypeError: object of type ‘float’ has no len() Error Occurs?

Today I get the following error TypeError: object of type ‘float’ has no len() in python.

How To Solve TypeError: object of type ‘float’ has no len() Error ?

  1. How To Solve TypeError: object of type 'float' has no len() Error ?

    To Solve TypeError: object of type 'float' has no len() Error You may also check the name of the sheet is int or float. Convert that to string.

  2. TypeError: object of type 'float' has no len()

    To Solve TypeError: object of type 'float' has no len() Error You may also check the name of the sheet is int or float. Convert that to string.

Solution 1

The error is exactly what is says it is. rotlati is a float. You cannot take the len() of a float. Looking at your code, it looks as if you might have meant to create lists called rotlati and rotlongi and append to them on each iteration of your range(len(lati)) loop. Instead you’re currently just overwriting the same two floating-point variables on every iteration.

Solution 2

Another scenario i got the same error, while saving file.

odf.to_excel(writer,sheet_name=str(x),startcol=5,index=False)

You may also check the name of the sheet is int or float. Convert that to string.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read