python tile函数用法
tile函数位于python模块 numpy.lib.shape_base中,他的功能是重复某个数组。比如tile(A,n),功能是将数组A重复n次,构成一个新的数组,我们还是使用具体的例子来说明问题:
先来引入numpy下的所有方法:
>>> from numpy import *
我们创建一个a,如图下图,使用tile来创建b,注意看b的数据结构:
>>> a=[0,1,2]
>>> b=tile(a,2)
>>> b
array([0, 1, 2, 0, 1, 2])
假如我们输入一个元组(1,2),我们会得到一样的结果,与上面相同的b
>>> b=tile(a,(1,2))
>>> b
array([[0, 1, 2, 0, 1, 2]])
当然,我们想要a变为一个二维数组,就要换一种重复的方式了。
>>> b=tile(a,(2,1))
>>> b
array([[0, 1, 2],
[0, 1, 2]])
python tile函数用法的更多相关文章
- Python回调函数用法实例详解
本文实例讲述了Python回调函数用法.分享给大家供大家参考.具体分析如下: 一.百度百科上对回调函数的解释: 回调函数就是一个通过函数指针调用的函数.如果你把函数的指针(地址)作为参数传递给另一个函 ...
- python之函数用法setdefault()
# -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法setdefault() #D.get(k,d) #说明:k在D中,则返回 D[K], ...
- python之函数用法fromkeys()
# -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法fromkeys() #fromkeys() #说明:用于创建一个新字典,以序列seq ...
- python之函数用法get()
# -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法get() #http://www.runoob.com/python/att-dic ...
- python之函数用法capitalize()
# -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法capitalize() #capitalize() #说明:将字符串的第一个字母变成 ...
- python之函数用法isupper()
# -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法isupper() #http://www.runoob.com/python/att ...
- python之函数用法islower()
# -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法islower() #http://www.runoob.com/python/att ...
- python之函数用法startswith()
# -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法startswith() #http://www.runoob.com/python/ ...
- python之函数用法endswith()
# -*- coding: utf-8 -*- #python 27 #xiaodeng #python之函数用法endswith() #http://www.runoob.com/python/at ...
随机推荐
- VC高手们的博客
http://www.cnblogs.com/killmyday/tag/Debug/ (关于符号调试等内容比较多)
- 使用Intellij IDEA从零使用Spring MVC
原文:使用Intellij IDEA从零使用Spring MVC 使用Intellij IDEA从零使用Spring MVC 黑了Java这么多年, 今天为Java写一篇文章吧. 这篇文章主要是想帮助 ...
- nginx添加nginx_mod_h264_streaming-2.2.7模块编译报错
报错ngx_http_streaming_module.c:158: 错误:‘ngx_http_request_t’ 没有名为 ‘zero_in_uri’ 的成员.这需要修改nginx_mod_h26 ...
- installation and configuration of OpenCV4Android SDK
http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/O4A_SDK.html#running-opencv ...
- Algorithm: cartesian tree
http://baike.baidu.com/link?url=XUt5fXQ-jtFBM0UdKiGA41_NWFvdFSYwVsy4SVvCRRuEBvNkLfT9TgOtzsXvaOT9nuq_ ...
- Github原理
See image below:
- 21.allegro下鼠标形状设置[原创]
1. -- --- ----- ---
- 10.cadence.自定义焊盘的创建[原创]
一.自定义图形焊盘 1.设置环境(面板大小,格点) --- ------ 圆形 Shape > Circular ---- 两个DRC错误,证明图形重合了, 将图形复合一下: --- 椭圆类焊盘 ...
- Android启动过程以及各个镜像的关系
Android启动过程 Android在启动的时候,会由UBOOT传入一个init参数,这个init参数指定了开机的时候第一个运行的程序,默认就是init程序,这个程序在ramdisk.img中.可以 ...
- 无锁编程(一) - Double-checked Locking
Double-checked Locking,严格意义上来讲不属于无锁范畴,无论什么时候当临界区中的代码仅仅需要加锁一次,同时当其获取锁的时候必须是线程安全的,此时就可以利用 Double-che ...