问题
for a pandas.DataFrame: df
min max mean
a 0.0 2.300000e+04 6.450098e+02
b 0.0 1.370000e+05 1.651754e+03
c 218.0 1.221550e+10 3.975262e+07
d 1.0 5.060000e+03 2.727708e+02
e 0.0 6.400000e+05 6.560047e+03
I would like to format the display such as numbers show in the ":,.2f" format (that is ##,###.##) and remove the exponents.
I tried: df.style.format("{:,.2f}")
which gives: <pandas.io.formats.style.Styler object at 0x108b86f60>
that i have no idea what to do with.
Any lead please?
回答1:
try this young Pandas apprentice
pd.options.display.float_format = '{:,.2f}'.format
来源:https://stackoverflow.com/questions/46773603/formatting-numbers-in-pandas