I have the following code that rolls a window of size 3 column-wise (i.e. downwards as depicted in green in the image). However, I'd like the window to roll row-wise (i.e. rightwards as depicted in blue in the image).

window_size = 3
numbers_series = X #X is my dataframe
windows = numbers_series.rolling(window_size)
moving_averages = windows.mean()
moving_averages_list = moving_averages.values.tolist()
without_nans = moving_averages[window_size - 1:]
print(without_nans)
But this is not what I want - I'd like it to give me the mean of the windows row-wise. How do I go about achieving this?
EDIT:
After editing the above code to include axis=1 in the rolling function, this is the output I get:

I'm not sure how the values of 520.67, 635.33, etc are computed above. I was expecting the following (first cell: 788 + 43 + 345)/3 = 392, etc...):

