I simply want to use the Ramer–Douglas–Peucker algorithm (RDP) and its Python implementation to reduce jitternez from pricecharts.
So i tried the following:
import yfinance as yf
import matplotlib.pyplot as plt
import numpy as np
from rdp import rdp
stock = 'AMZN'
start = '2020-11-01'
df = yf.download(stock , start=start)
nfx = []
nfy = []
for index, row in df.iterrows():
x_data = nfx.append(index)
y_data = nfy.append(row['Close'])
rdpp = [rdp(np.array([nfy]), epsilon=0.2)]
plt.plot(rdpp)
plt.show()
this however does not work. Either i get error messages or an empty plot.
What can i do/improve to make that work?
Here is the Documentation, but its small and i dont really get how to apply this in my case. -->