Table of Contents
名称 | 描述 | 简写 |
---|---|---|
np.bool | 用一个字节存储的布尔类型(True或False) | 'b' |
np.int8 | 一个字节大小,-128 至 127 | 'i' |
np.int16 | 整数,-32768 至 32767 | 'i2' |
np.int32 | 整数,-2^31 至 2^32 -1 | 'i4' |
np.int64 | 整数,-2^63 至 2^63 - 1 | 'i8' |
np.uint8 | 无符号整数,0 至 255 | 'u' |
np.uint16 | 无符号整数,0 至 65535 | 'u2' |
np.uint32 | 无符号整数,0 至 2^32 - 1 | 'u4' |
np.uint64 | 无符号整数,0 至 2^64 - 1 | 'u8' |
np.float16 | 半精度浮点数:16位,正负号1位,指数5位,精度10位 | 'f2' |
np.float32 | 单精度浮点数:32位,正负号1位,指数8位,精度23位 | 'f4' |
np.float64 | 双精度浮点数:64位,正负号1位,指数11位,精度52位 | 'f8' |
np.complex64 | 复数,分别用两个32位浮点数表示实部和虚部 | 'c8' |
np.complex128 | 复数,分别用两个64位浮点数表示实部和虚部 | 'c16' |
np.object_ | python对象 | 'O' |
np.string_ | 字符串 | 'S' |
np.unicode_ | unicode类型 | 'U' |
- int8 int16 ….
4.ndarray 基本操作
- 生成0,1数组的方法
- np.ones([4,7]) 4行七列
- np.ones_like() 通过谁生成
- np.zeros()
- np.zeros._like() 通过谁生成
- asarray()和array()
- asaary是浅拷贝
- array是深拷贝
- 生成固定范围的数组
- np.linspace(start,stop,num,endpoint) 平均分布的数据
- start 开始
- stop结束
- num 等间隔的样例(多少个数字)
- endpoint 是否包含最后一个值
- np.arange(start,stop.step,dtype)
- 每间隔生成多少数字
- np.logspace(start,stop,num)
- 生成的数字,以10为指数,10的几次方
- np.linspace(start,stop,num,endpoint) 平均分布的数据
-
生成随机数组
- 使用模块
- np.random 模块
- 均匀分布
- np.random.rand()
- 返回 0.0 1.0 内的一组均匀分布的数
- np.random.uniform(low,high,size)
- 生成浮点数
- low 下界
- high 上界
- size 行列(2,4)
- np.random.randint(low,high,size)
- 生成整数
- np.random.rand()
- 使用模块
2.扩展延伸知识
-
jupyter notebook 中文乱码
- import matplotlib.pyplot as plt
- plt.rcParams['font.sans-serif']=['SimHei']
- plt.rcParams['axes.unicode_minus']=False
- https://blog.csdn.net/moonlightpeng/article/details/106985116
-
jupyter notebook 提示代码
-
%time 使用
- 魔方方法,可以看到函数执行时间,占用率
-
python 执行匿名函数出错
- (intermediate value)(...) is not a function
- 需要匿名函数前加 ;
- https://blog.csdn.net/liyujia6636/article/details/55669187
-
美团逆向
3.灵感代办
4.复习内容
5.学习成果&问题
jupyter notebook 中文乱码
- import matplotlib.pyplot as plt
- plt.rcParams['font.sans-serif']=['SimHei']
- plt.rcParams['axes.unicode_minus']=False
- https://blog.csdn.net/moonlightpeng/article/details/106985116
jupyter notebook 提示代码
%time 使用
- 魔方方法,可以看到函数执行时间,占用率
python 执行匿名函数出错
- (intermediate value)(...) is not a function
- 需要匿名函数前加 ;
- https://blog.csdn.net/liyujia6636/article/details/55669187
美团逆向
4.复习内容
5.学习成果&问题