[Python] Get number of decimals in python float, including trailing zeros [closed]

Discussão em 'Python' iniciado por Stack, Novembro 21, 2024.

  1. Stack

    Stack Membro Participativo

    I need to find the number of decimals a float has in python. The data is imported from excel using pandas.

    I tried converting to a string and counting the number of integers after the decimal. The problem is that this approach does not account for any trailing zeros so it seems as if there are less decimals than in reality. Multiplying by 10^x also does not work because the number of decimals varies.

    Thanks in advance for the help!

    Continue reading...

Compartilhe esta Página