为什么Pandas的结果不同_泰利布麦德()和泰利布麦德()?

2024-03-28 11:13:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我被结果搞糊涂了。在

在我看来,它有多种版本。在

如果不是,为什么它们不同?在

print(p_df.head())
                 c
timestamp         
2017-04-19  2852.0
2017-04-20  2889.0
2017-04-21  2928.0
2017-04-24  2928.0
2017-04-25  2949.0

p_arr = np.array(p)

^{pr2}$
import talib

macd2 = np.vstack( talib.MACD( p_arr, 12, 26, 9 ) )

macd2 = pd.DataFrame( macd2.T,
                      index   = p_df.index,
                      columns = ['macd','macdsignal','macdhist']
                      )
macd2 = p_df.join( macd2 )
print( macd2.tail( 10 ) )
                 c       macd  macdsignal   macdhist
timestamp                                           
2017-10-17  3738.0 -27.384079  -44.076077  16.691997
2017-10-18  3688.0 -27.065785  -40.674018  13.608233
2017-10-19  3604.0 -33.208822  -39.180979   5.972157
2017-10-20  3776.0 -23.922497  -36.129283  12.206786
2017-10-23  3699.0 -22.516715  -33.406769  10.890054
2017-10-24  3740.0 -17.888063  -30.303028  12.414965
2017-10-25  3705.0 -16.849797  -27.612382  10.762585
2017-10-26  3649.0 -20.311556  -26.152217   5.840661
2017-10-27  3577.0 -28.535880  -26.628949  -1.906930
2017-10-30  3571.0 -35.132875  -28.329735  -6.803141

A plot for comparisonenter image description here My TA Lib是从TA峎u Lib‑0.4.10‑cp36‑cp36m‑win_amd64.whl
https://www.lfd.uci.edu/~gohlke/pythonlibs/)。在

Name:         TA-Lib
Version:      0.4.10
Summary:      Python wrapper for TA-Lib
Home-page:    http://github.com/mrjbq7/ta-lib
Author:       John Benediktsson
Author-email: mrjbq7@gmail.com
License:      UNKNOWN
Location:     c:\users\trader\anaconda3\envs\py36\lib\site-packages
Requires:

Tags: comdfforindexlibnptimestampprint