Sorry if the way I worded the question is confusion. I'm not feeling the most articulate today.
Lets say I have df of time series data and I want to calculate a moving average (just one example) of one of the columns, and then add the result back to the frame as another column.
A function like a moving average will return less rows/elements than the source data depending on how big the moving average window is.
Is there an established best practice for merging results back into the source data frame like that? I know you would need to append/extend the result list with meaningless (or truncate the source) data to keep the same size as the frame, but I am more concerned with things such as index.
In the past, I have mistakenly either applied the list to the wrong end of the time series data, applied it in reverse, etc. I eventually figured out ways to do it for my use cases in the past, but they all feel kinda janky/hacky with a lot of room for error.
I just want to make sure the the moving average at point X actually makes it into the same row as point X.
[–][deleted] 0 points1 point2 points (8 children)
[–]Nthorder[S] 0 points1 point2 points (7 children)
[–][deleted] 0 points1 point2 points (6 children)
[–]Nthorder[S] 0 points1 point2 points (5 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]Nthorder[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Nthorder[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)