/Users/yaochenli/anaconda3/lib/python3.7/site-packages/pandas/plotting/_converter.py:129: FutureWarning: Using an implicitly registered datetime converter for a matplotlib plotting method. The converter was registered by pandas on import. Future versions of pandas will require you to explicitly register matplotlib converters.
To register the converters:
>>> from pandas.plotting import register_matplotlib_converters
>>> register_matplotlib_converters()
warnings.warn(msg, FutureWarning)
Text(0.5, 1.0, '2014年青岛啤酒股票收盘价时序图')
/Users/yaochenli/anaconda3/lib/python3.7/site-packages/matplotlib/font_manager.py:1241: UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans.
(prop.get_family(), self.defaultFamily[fontext]))
Sma5=pd.Series(0.0,index=Close.index)
for i inrange(4,len(Close)):
Sma5[i]=np.mean(Close[(i-4):(i+1)])
Sma5.tail()
defsmaCal(tsPrice,k):import pandas as pd
Sma=pd.Series(0.0,index=tsPrice.index)for i inrange(k-1,len(tsPrice)):
Sma[i]=sum(tsPrice[(i-k+1):(i+1)])/k
return(Sma)
W M A t = 5 = w 1 p 1 + w 2 p 2 + w 3 p 3 + w 4 p 4 + w 5 p 5 WMA_{t=5}=w_1p_1+w_2 p_2+w_3 p_3+w_4 p_4 + w_5 p_5 WMAt=5=w1p1+w2p2+w3p3+w4p4+w5p5