<p>我试图在Ubuntu 12.04上使用python中的TA Lib作为<a href="http://mrjbq7.github.io/ta-lib/" rel="nofollow noreferrer">described in the official documentation</a>。但是,当使用pandas<code>DataFrame</code>s或<code>Series</code>时,如不同来源上的多个示例所示,我得到以下<code>TypeError</code>:</p>
<blockquote>
<p>Traceback (most recent call last): File "test1.py", line 14, in
analysis['rsi'] = ta.RSI(spy.Close) TypeError: Argument 'real' has incorrect type (expected numpy.ndarray, got Series)</p>
</blockquote>
<p>执行本代码时:</p>
<pre><code>import pandas.io.data as data
import pandas as pd
import talib as ta
import matplotlib.pyplot as plt
# Download SP500 data with pandas
spyidx = data.get_data_yahoo('SPY', '2013-01-01')
analysis = pd.DataFrame(index = spyidx.index)
analysis['rsi'] = ta.RSI(spyidx.Close)
</code></pre>
<p>出什么事了?</p>