【python系列】numpy中的tile函数
来源:互联网 发布:虚幻4的蓝图编程 编辑:程序博客网 时间:2024/06/05 03:23
tile函数
在看机器学习实战这本书时,遇到numpy.tile(A,B)函数,愣是没看懂怎么回事,装了numpy模块后,实验了几把,原来是这样子:
重复A,B次,这里的B可以时int类型也可以是远组类型。
- >>> import numpy
- >>> numpy.tile([0,0],5)#在列方向上重复[0,0]5次,默认行1次
- array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
- >>> numpy.tile([0,0],(1,1))#在列方向上重复[0,0]1次,行1次
- array([[0, 0]])
- >>> numpy.tile([0,0],(2,1))#在列方向上重复[0,0]1次,行2次
- array([[0, 0],
- [0, 0]])
- >>> numpy.tile([0,0],(3,1))
- array([[0, 0],
- [0, 0],
- [0, 0]])
- >>> numpy.tile([0,0],(1,3))#在列方向上重复[0,0]3次,行1次
- array([[0, 0, 0, 0, 0, 0]])
- >>> numpy.tile([0,0],(2,3))<span style=“font-family: Arial, Helvetica, sans-serif;”>#在列方向上重复[0,0]3次,行2次</span>
- array([[0, 0, 0, 0, 0, 0],
- [0, 0, 0, 0, 0, 0]])
>>> import numpy>>> numpy.tile([0,0],5)#在列方向上重复[0,0]5次,默认行1次array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0])>>> numpy.tile([0,0],(1,1))#在列方向上重复[0,0]1次,行1次array([[0, 0]])>>> numpy.tile([0,0],(2,1))#在列方向上重复[0,0]1次,行2次array([[0, 0], [0, 0]])>>> numpy.tile([0,0],(3,1))array([[0, 0], [0, 0], [0, 0]])>>> numpy.tile([0,0],(1,3))#在列方向上重复[0,0]3次,行1次array([[0, 0, 0, 0, 0, 0]])>>> numpy.tile([0,0],(2,3))<span style="font-family: Arial, Helvetica, sans-serif;">#在列方向上重复[0,0]3次,行2次</span>array([[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]])
阅读全文
0 0
- 【python系列】numpy中的tile函数
- 【python系列】numpy中的tile函数
- 【python系列】numpy中的tile函数
- python numpy.tile函数
- Python&Numpy:tile函数
- python numpy.tile函数
- numpy中的tile函数
- numpy中的tile函数
- numpy中的tile函数
- numpy中的tile函数
- numpy中的tile函数
- numpy中的tile函数
- numpy中的tile函数
- Python-Numpy函数-tile函数
- python: numpy --函数 tile用法
- Python-Numpy的tile函数
- Python numpy函数:tile()
- Python中的tile函数
- svn
- 常用as插件下载使用
- 在面试过程中面试官可能会问到的问题
- navicat数据库报错1045
- 七种常用特征工程
- 【python系列】numpy中的tile函数
- 阿里云服务器基础配置详解(二)安装Mysql
- 多重共线性问题的几种解决方法
- apache2.4.17 编译安装
- 【JLOI2016】bzoj4558 方
- qt交叉编译arm时出现的一些错误和解决方法
- window opengl
- pandas中merage,join和concat
- 埃文科技推出免费区县级别IP地址定位库 提升IP地址定位行业标准