Suppressing scientific notation in pandas?

后端 未结 4 1376
清酒与你
清酒与你 2020-11-27 05:49

I have a DataFrame in pandas where some of the numbers are expressed in scientific notation (or exponent notation) like this:

                  id        val         


        
4条回答
  •  忘掉有多难
    2020-11-27 06:55

    Try this which will give you scientific notation only for large and very small values (and adds a thousands separator unless you omit the ","):

    pd.set_option('display.float_format', lambda x: '%,g' % x)
    

    Or to almost completely suppress scientific notation without losing precision, try this:

    pd.set_option('display.float_format', str)
    

提交回复
热议问题