1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| import pandas as pd import matplotlib.pyplot as plt stockValues = pd.DataFrame( {'Stock_Values': [60, 102, 103, 104, 101, 105, 102, 103, 103, 102]}) ema = stockValues.ewm(com=0.4).mean() print(ema)
plt.plot(stockValues, label="Stock Values") plt.plot(ema, label="EMA Values") plt.xlabel("Days") plt.ylabel("Price") plt.legend() plt.show()
|