- Hands-On Data Science and Python Machine Learning
- Frank Kane
- 203字
- 2021-07-15 17:14:59
Importing modules
Python itself, like any language, is fairly limited in what it can do. The real power of using Python for machine learning and data mining and data science is the power of all the external libraries that are available for it for that purpose. One of those libraries is called NumPy, or numeric Python, and, for example, here we can import the Numpy package, which is included with Canopy as np.
This means that I'll refer to the NumPy package as np, and I could call that anything I want. I could call it Fred or Tim, but it's best to stick with something that actually makes sense; now that I'm calling that NumPy package np, I can refer to it using np:
import numpy as np
In this example, I'll call the random function that's provided as part of the NumPy package and call its normal function to actually generate a normal distribution of random numbers using these parameters and print them out. Since it is random, I should get different results every time:
import numpy as np
A = np.random.normal(25.0, 5.0, 10)
print (A)
The output should look like this:

Sure enough, I get different results. That's pretty cool.
- Apache Oozie Essentials
- HTML5+CSS3基礎(chǔ)開發(fā)教程(第2版)
- Django:Web Development with Python
- The DevOps 2.4 Toolkit
- Learning Apache Mahout Classification
- Java程序設(shè)計(jì):原理與范例
- 利用Python進(jìn)行數(shù)據(jù)分析(原書第3版)
- Java系統(tǒng)化項(xiàng)目開發(fā)教程
- R語(yǔ)言與網(wǎng)絡(luò)輿情處理
- RealSenseTM互動(dòng)開發(fā)實(shí)戰(zhàn)
- Node.js開發(fā)指南
- 算法圖解
- Selenium WebDriver Practical Guide
- Mastering OpenStack
- Node.js 6.x Blueprints