Home > other >  Consult the python with moving average to fill vacancies
Consult the python with moving average to fill vacancies

Time:01-08

This is want to process data, my idea is to use moving average (moving average) to fill the window period for 6 months, if the data is less than 6 just in front of the number of existing and new fill empty then as an empty after ma the reference value, and then my code is
 mda. [" MT "]=mda groupby (" stock_code ") [' MT]. Transform (lambda x: x.f illna (x.r olling (6, 1). The mean ())) 


But the result is only fill the digital smooth down in front of the



This is my output result, obviously not what I want
For leaders to help them make the younger brother
  • Related