擅长:python、mysql、java
<p>你可以使用熊猫图书馆。它是使用numpy构建的,提供丰富的文档和奇妙的操作,如透视图、图形、元素操作,。。。他们很多</p>
<p><strong>注意</strong>:熊猫不是纽比的替代品。在</p>
<p><a href="http://pandas.pydata.org/pandas-docs/stable/basics.html#applying-elementwise-python-functions" rel="nofollow">Pandas element wise operation</a></p>
<p>这是元素操作的一个特例</p>
<pre><code>>>> sam = np.arange(15)
>>> print sam
[ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14]
>>> print pd.rolling_apply(sam, 2, lambda x: x[1] - x[0])
[ nan 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1. 1.]
</code></pre>