[Python] round() not working in pandas with a df column of float64 type

Discussão em 'Python' iniciado por Stack, Maio 25, 2025.

  1. Stack

    Stack Membro Participativo

    I try to round numbers from a column in float64 type but round() does not work, although I’ve tried several syntaxes : df ["column"]. round(1) ; df ["column"].astype("float").round(1) ; df ["column"].astype("float64").round(1) ; df ["column"].astype(float).round(1)

    I can manage to get the result with the following formula: df["column"].map('{:,.1f}'.format) however it is less practical and straightforward that round().

    Continue reading...

Compartilhe esta Página