Not duplicate because I'm asking about pandas round()
.
I have a dataframe
with some columns with numbers. I run
df = df.round(decimals=6)
That successfully truncated the long decimals instead of 15.36785699998
correctly writing: 15.367857
, but I still get 1.0
or 16754.0
with a trailing zero.
How do I get rid of the trailing zeros in all the columns, once I ran pandas df.round()
?
I want to save the dataframe as a csv, and need the data to show the way I wish.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…