1.Import the numpy package under the name np (★☆☆)
#导入numpy模块
import numpy as np
2.Print the numpy version and the configuration (★☆☆)
#打印numpy的版本信息
print np.version.version
print np.__version__
np.show_config()
3.Create a null vector of size 10 (★☆☆)
#新建全为0的数组
vector=np.zeros(10)#一维
vector_2=np.zeros((10,10))#二维
4.How to find the memory size of any array (★☆☆)
#数组所占内存大小=元素个数*每个元素的大小
print vector.size*vector.itemsize
5.How to get the documentation of the numpy add function from the command line? (★☆☆)
#命令行获取numpy的add函数的文档信息
python -c "import numpy;numpy.info(numpy.add)"
6.Create a null vector of size 10 but the fifth value which is 1 (★☆☆)
#创建非空的大小为10的数组,第5个元素为1
vector=np.zeros(10)
vector[4]=1
7.Create a vector with values ranging from 10 to 49 (★☆☆)
#创建一个数组,元素值从10-49
vector=np.arange(10,50)
8.Reverse a vector (first element becomes last) (★☆☆)
#翻转一个数组
vector[::-1]
9.Create a 3x3 matrix with values ranging from 0 to 8 (★☆☆)
#创建一个3*3的矩阵,元素值为0-8
vector=np