天天看点

python numpy和pandas做数据分析时去掉科学记数法显示

1.Numpy

1 import numpy as np
2 np.set_printoptions(suppress=True, threshold=np.nan)      

suppress=True 取消科学记数法

threshold=np.nan 完整输出(没有省略号)

2.Pandas

1 pd.set_option('display.float_format', lambda x: '%.3f' % x)      

用pd.set_option设置display.float_format参数来设置显示的小数位数

转载于:https://www.cnblogs.com/yuejucai/p/10786690.html