Python-Numpy(4)常用函数
来源:互联网 发布:青岛创业软件待遇如何 编辑:程序博客网 时间:2024/06/06 09:16
import numpy as npB = np.arange(3)print B#print np.exp(B)print np.sqrt(B)
#Return the floor of the inputa = np.floor(10*np.random.random((3,4)))print a#a.shape## flatten the array#print a.ravel()#a.shape = (6, 2)# print a print a.Tprint a.resize((2,6))print a#If a dimension is given as -1 in a reshaping operation, the other dimensions are automatically calculated:#a.reshape(3,-1)
a = np.floor(10*np.random.random((2,2)))b = np.floor(10*np.random.random((2,2)))print aprint '---'print bprint '---'print np.hstack((a,b))#np.hstack((a,b))
a = np.floor(10*np.random.random((2,12)))#print a#print np.hsplit(a,3)#print np.hsplit(a,(3,4)) # Split a after the third and the fourth columna = np.floor(10*np.random.random((12,2)))print anp.vsplit(a,3)
#Simple assignments make no copy of array objects or of their data.a = np.arange(12)b = a# a and b are two names for the same ndarray objectb is ab.shape = 3,4print a.shapeprint id(a)print id(b)
#The view method creates a new array object that looks at the same data.c = a.view()c is ac.shape = 2,6#print a.shapec[0,4] = 1234a
#The copy method makes a complete copy of the array and its data.d = a.copy() d is ad[0,0] = 9999print d print a
阅读全文
0 0
- Python-Numpy(4)常用函数
- Python numpy 常用函数总结
- Python拓展包:Numpy,pandas...常用函数
- Python Numpy包 常用函数总结
- Python矩阵运算库numpy常用函数
- python numpy:1 numpy.array和numpy.matrix常用函数使用
- python 中 常用到的 numpy 函数 整理
- python 中 常用到的 numpy 函数 整理
- python学习之1 numpy常用的函数
- python 中 常用到的 numpy 函数 整理
- python 中 常用到的 numpy 函数 整理
- python 中 常用到的 numpy 函数 整理
- python 中 常用到的 numpy 函数 整理
- Python之Numpy库常用函数大全(含注释)
- python之numpy库学习常用函数(构建数据)
- python之numpy库学习常用函数(矩阵索引数据)
- python之numpy库学习常用函数(矩阵运算)
- Python之Numpy库常用函数大全(含注释)
- 悲观锁与乐观锁的区别
- 什么花不能养?
- [随笔]一种方法论
- org.apache.tomcat.util.bcel.classfile.ClassFormatException: It is not a Java .class file 的解决方法
- Hdu6105 Gameia(2017多校第6场)
- Python-Numpy(4)常用函数
- Retrofit 2.3使用随文笔录
- 邝斌的ACM模板(扩展 KMP)
- Source Insight 4.0安装后首次打开报错
- listview分页加载
- Struts2--自定义拦截器
- Qt中qDebug 的使用
- IE兼容 请求参数中文乱码或请求无效 转义与转码
- 树莓派使用mjpeg-streamer监控