Relative Content

Tag Archive for pythonpandasdataframenumpy

Drop row in dataframe if equal to previous row

I have a dataframe like the one below, where I have a daily count of points for each team. However, it’s a tough task to earn points and on many days the points stay the same. Since I’m turning the dataframe into a chart, I want to remove the rows where the point values are the same as that of the previous day. So in this case we keep row 0, row 1 is the same so we omit it, then keep row 2 because it’s different from row 1.

How to compute moving average convergence divergence without using pandas ewm function?

I’m trying to compute the moving average divergence convergence (MACD) which is a technical indicator in trading. To compute MACD we have to find out exponential moving average over a certain period or a time window n(I will be providing the procedure, code on how the moving average and a sample input before the signal column is computed). The signal values range from -10 to 10. I kept getting KeyError: ‘close’. I could not understand how to proceed further please do let me know how I can correct this.