Python
ChadPro
这个作者很懒,什么都没留下…
展开
-
Numpy dot & multiply
np.dot1.一维情况import numpy as npa1 = np.array([1,2,3])a2 = np.array([2,3,4])mul1 = np.dot(a1, a2)print mul1输出结果[20], 即是计算:a_{1} * a_{2}^{T}2.二维情况import numpy as npa1 = np.reshape(np.arange(...原创 2018-12-18 11:06:07 · 267 阅读 · 0 评论 -
Python --- Parse XML
Python Parse XMLUse ElementTree0. ImportElementTree 生来就是为了处理 XML ,它在 Python 标准库中有两种实现。一种是纯 Python 实现例如 xml.etree.ElementTree ,另外一种是速度快一点的 xml.etree.cElementTree 。你要记住: 尽量使用 C 语言实现的那种,因为它速度更快,而且消耗的内...原创 2018-12-18 16:01:43 · 3092 阅读 · 0 评论 -
Python---BroadCast
1. Numpy1.创建 2*2*3的数据import numpy as npl1 = np.arange(12)l1 = np.reshape(l1, (2,2,3))print l1[[[ 0 1 2] [ 3 4 5]] [[ 6 7 8] [ 9 10 11]]]2.数据每一位加1import numpy as npl1 = np.arange...原创 2018-12-18 16:29:14 · 835 阅读 · 1 评论