How to suppress scientific notation when printing float values?

后端 未结 12 1262
猫巷女王i
猫巷女王i 2020-11-22 07:12

Here\'s my code:

x = 1.0
y = 100000.0    
print x/y

My quotient displays as 1.00000e-05.

Is there any way to suppress

12条回答
  •  孤独总比滥情好
    2020-11-22 07:38

    Another option, if you are using pandas and would like to suppress scientific notation for all floats, is to adjust the pandas options.

    import pandas as pd
    pd.options.display.float_format = '{:.2f}'.format
    

提交回复
热议问题