0

I have a univariate data frame:

Y=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20] 

I would like to split it so that I obtain different data frames for x timesteps. For eg, for the case of 2 timesteps, I'd like:

Y[1]=[1,2]
Y[2]=[3,4]
Y[3]=[5,6]

and so on.....

I even have python code for the same -

dfs = list()
for x in range(0, len(Y), 2):
    df = Y.iloc[x:x+2]
    df.columns= ['one','two']
    dfs.append(df)
for df in dfs:
    print(df)
    print()
DGT
  • 39
  • 9

0 Answers0