简体   繁体   English

如何将numpy分布转换为数组?

[英]How to convert numpy distribution to an array?

I am using the function numpy.random.normal(0,0.1,20) to generate some numbers. 我正在使用numpy.random.normal(0,0.1,20)函数生成一些数字。 Given below is the output I get from the function. 下面给出的是我从函数中获得的输出。 The problem is I want these numbers to be in an array format. 问题是我希望这些数字采用数组格式。

[ 0.13500488 0.11023982 0.09908623 -0.01437589 0.00619559 -0.17200946 -0.00501746 0.07422642 0.1226481 -0.01422786 -0.02986386 -0.02507335 -0.12959589 -0.09346143 -0.01287027 0.02656667 -0.07538371 -0.10534301 -0.02208811 -0.14634084] [0.13500488 0.11023982 0.09908623 -0.01437589 0.00619559 -0.17200946 -0.00501746 0.07422642 0.1226481 -0.01422786 -0.02986386 -0.02507335 -0.12959589 -0.09346143 -0.01287027 0.02656667 -0.07538371 -0.10534301 -0.02208811 -0.14634084]

Can anyone help me? 谁能帮我?

只需在您的normal呼叫周围放置一个list(...)调用,它就会变成一个常规的Python列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM