[英]How do i suppress exponential display output
I am having difficulty to format a simply float column in a dataframe:我很难在 dataframe 中格式化一个简单的浮点列:
output_df['ann_avg_prem'].map('${:,.2}'.format)
I would like output that resembles:我想要 output 类似于:
0 $1,650.00
1 $1,650.00
But for some reason, I cannot suppress the exponential notation.但由于某种原因,我无法抑制指数符号。 I would like to maintain space in my presentation output for up to $99,999,999.99.
我想在我的演示文稿 output 中保留空间,最高 99,999,999.99 美元。
Here is what I am getting instead:这是我得到的:
0 $ 1.6e+03
1 $ 1.6e+03
2 $ 1.6e+03
3 $ 1.6e+03
4 $ 1.6e+03
Name
e: ann_avg_prem, dtype: object
I seriously cannot make any sense of the documentation for formatting, and everything I am trying is giving me an error message.我真的无法理解格式化文档,我正在尝试的一切都是给我一条错误消息。
Add f
specifier:添加
f
说明符:
df.x.map('${:,.2f}'.format)
# ^ this
Output: Output:
0 $1,650.00
1 $1,650.00
Name: x, dtype: object
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.