为什么在数据框中计算时使用 python returns 科学记数法?
Why python returns scientific notation when calculate in the dataframe?
当我使用 Python 在数据框中进行计算时,它 return 是科学记数法的结果...有没有不用科学记数法计算结果的方法(只是 return浮动)?那些突出显示的数字应该是 0。
感谢您的帮助。
选项 1:您可以使用一个选项:display.precision
:pd.set_option('precision', 5)
选项 2:您可以使用浮点格式:
pd.options.display.float_format = '${:,.5f}'.format
选项 3:您可以使用回合:
DataFrame.round(decimals=0, *args, **kwargs) to can round close to the nearest number:
df.round(5) # for whole dataframe
当我使用 Python 在数据框中进行计算时,它 return 是科学记数法的结果...有没有不用科学记数法计算结果的方法(只是 return浮动)?那些突出显示的数字应该是 0。
感谢您的帮助。
选项 1:您可以使用一个选项:display.precision
:pd.set_option('precision', 5)
选项 2:您可以使用浮点格式:
pd.options.display.float_format = '${:,.5f}'.format
选项 3:您可以使用回合:
DataFrame.round(decimals=0, *args, **kwargs) to can round close to the nearest number:
df.round(5) # for whole dataframe