Home > OS >  How to print the contents of a Rolling window
How to print the contents of a Rolling window

Time:06-03

I run code like this:

resampleStr = '180 D'
dfRollSeries = df['Close'].rolling(resampleStr)
print(dfRollSeries)

The output is:

Rolling [window=180 D,min_periods=1,center=False,win_type=freq,axis=0,method=single]

I want to see the entries of the Rolling window (as a Dataframe?), not that it is a rolling window. How do I do this?

CodePudding user response:

Unpack the rolling object:

[*df['Close'].rolling('180d')]

If you want to print contents:

for s in df['Close'].rolling('180d'):
    print(s)
  • Related