Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 抑制列表中的科学符号_Python_List_Jupyter Notebook_Decimal_Scientific Notation - Fatal编程技术网

Python 抑制列表中的科学符号

Python 抑制列表中的科学符号,python,list,jupyter-notebook,decimal,scientific-notation,Python,List,Jupyter Notebook,Decimal,Scientific Notation,我试图生成泊松分布点,但python给了我科学符号的输出。我需要轻松地将数字形象化,并看到趋势,为此,我试图压制科学符号。我在网上尝试了很多解决方案,但还没有成功 x = [] for i in range(0,50): x.append(poisson.pmf(i, 10)) print(x) plt.plot(x) 输出: [4.5399929762484854e-05, 0.0004539992976248486, 0.0022699964881242435, 0.00756

我试图生成泊松分布点,但python给了我科学符号的输出。我需要轻松地将数字形象化,并看到趋势,为此,我试图压制科学符号。我在网上尝试了很多解决方案,但还没有成功

x = []
for i in range(0,50):
    x.append(poisson.pmf(i, 10))
print(x)
plt.plot(x)
输出:

[4.5399929762484854e-05, 0.0004539992976248486, 0.0022699964881242435, 
 0.007566654960414144, 0.01891663740103538, 0.03783327480207079, 
 0.06305545800345125, 0.090079225719216, 0.11259903214902009, 
 0.12511003572113372, 0.12511003572113372, 0.11373639611012128, 0.09478033009176803, 0.07290794622443707, 0.05207710444602615, 
 0.034718069630684245, 0.021698793519177594, 0.012763996187751505, 
 0.007091108993195334, 0.003732162627997529, 0.0018660813139987742, 
 0.0008886101495232241, 0.0004039137043287357, 0.00017561465405597286, 
 7.317277252332212e-05, 2.9269109009328823e-05, 1.125734961897266e-05, 
 4.169388747767671e-06, 1.4890674099170028e-06, 5.134715206610449e-07, 
 1.7115717355368203e-07, 5.521199146892901e-08, 1.725374733404048e-08, 
 5.228408283042485e-09, 1.537767142071341e-09, 4.393620405918148e-10, 
 1.2204501127550308e-10, 3.2985138182568977e-11, 8.680299521728504e-12, 
 2.225717826084264e-12, 5.56429456521064e-13, 1.3571450159050293e-13, 
 3.23129765691677e-14, 7.514645713759808e-15, 1.7078740258545124e-15, 
 3.795275613009891e-16, 8.250599158717587e-17, 1.755446629514306e-17, 
 3.6571804781549065e-18, 7.463633628887677e-19]

试试这个,更多的压缩值试试“.2f”或任何你想要的小数点

x = []
for i in range(0,50):
    x.append(s.poisson.pmf(i, 10))
    x[i] = format(x[i], 'f')
print(x)
plt.plot(x)

另一种方法是更改numpy打印选项,如下所示:

np.set_printoptions(suppress=True)

这回答了你的问题吗?你用的是什么包装@Python\u Learner我的答案解决了你的问题吗?@AliHasanAhmedKhan是的,但有没有办法在不添加更多代码行的情况下将其插入到现有代码中?我指的是任何内置函数或类似的东西,因为我觉得如果我计划在我的原始代码中使用它,我希望它是健壮的。不过我很感谢你的帮助。谢谢大家!@Python_学习者现在检查我减少了一个循环