numpy_tile_function
来源:互联网 发布:死亡岛有网络怎么联机 编辑:程序博客网 时间:2024/06/05 03:44
numpy函数:tile函数用法
tile函数位于python模块 numpy.lib.shape_base中
功能是重复某个数组。比如tile(A,n),功能是将数组A重复n次,构成一个新的数组,我们还是使用具体的例子来说明问题:
1.引入numpy下的所有方法
from numpy import *
2.我们创建一个a,使用tile来创建b,注意看b的数据结构
a = [0,1,2] b = tile(a,2) b array([0, 1, 2, 0, 1, 2])
3.假如我们输入一个元组(1,2),我们会得到一样的结果,与上面相同的b
>>> b = tile(a,(1,2)) >>> b array([[0, 1, 2, 0, 1, 2]])
4.当然,我们想要a变成一个二维数组,就要换一种重复的方式了
>>> b = tile(a,(2,1)) >>> b array([[0, 1, 2], [0, 1, 2]])
阅读全文
0 0
- numpy_tile_function
- Servlet简介与Servlet和HttpServlet运行的流程
- ranlib的使用
- jquery(遍历-dom节点)
- Windows下安装XGBoost
- 基数排序
- numpy_tile_function
- MyBatis整合ehcache
- BlueROV-12: Install Raspbian and ssh Connection
- 渗透与入侵2-pstools
- operator_itemgetter函数
- 《Ray Tracing in One Weekend》——Chapter 0: Overview
- 解决WebView不支持input type=file
- python_sorted函数
- 『ORACLE』 表空间属性(11g)