How do I construct a column A, whose entries are equal to the mean/median/mode of the last 10 non-null entries of another column B?
Hello, I have a column A (around 15,000 rows) which has numbers and many null values (maybe 70-80% null). I would like to construct a column B which at row i, is equal to the the mean of: the *last 10 non-null values from A* --> this means take A[row i-1] , A[row i-2], ... and go back until you have 10 non-null values (or if you reach row 1 then take whatever number <= 10 of non-null values...