numpy.random.randn(100)我知道numpy是导入模块的名称,randn是在模块中定义的方法,但不确定.random是什么。是
谢谢,新年快乐!
发布于 2020-01-02 11:22:27
@Yann的回答是完全正确的,但可能不能使整个情况变得清晰。包结构最好的类比可能是文件夹。假设整个numpy包都是大文件夹。在上述文件夹中有一堆文件,这些是我们的功能。但是您也有子文件夹。随机是这些子文件夹之一。它包含更多的文件(函数),这些文件(函数)被组合在一起,因为它们与相同的事情有关,即随机性。
numpy
├── arccos
├── vectorize
├── random
│ ├── randn
│ ├── <more functions in the random subfolder>
│ <more functions in the numpy folder>发布于 2020-01-02 11:13:39
.random部件是numpy中的一个模块,如何确认这是使用python解释器
#first import numpy into the interpreter
import numpy
#this is so the interpreter displays the info about the random module
numpy.random输出应该类似于“从‘路径到模块’>的”<模块'numpy.random‘>!
https://stackoverflow.com/questions/59562096
复制相似问题