I would like to do this with a for loop. My code is:
PC1 = dfA.iloc[0:23]
PC2 = dfA.iloc[23:46]
PC3 = dfA.iloc[46:69]
PC4 = dfA.iloc[69:92]
PC5 = dfA.iloc[92:115]
PC6 = dfA.iloc[115:138]
PC7 = dfA.iloc[138:161]
PC8 = dfA.iloc[161:184]
PC9 = dfA.iloc[184:207]
PC10 = dfA.iloc[207:230]
PC11 = dfA.iloc[230:253]
PC12 = dfA.iloc[253:276]
PC13 = dfA.iloc[276:299]
PC14 = dfA.iloc[299:322]
PC15 = dfA.iloc[322:345]
PC16 = dfA.iloc[345:368]
PC17 = dfA.iloc[368:391]
I tried using a for loop for the numbers in the brackets.
for x in range(0,391,23):
y = x + 23
PC[i] = dfA.iloc[x:y]
But I have not found a way that the datasets will be created as in the code above, with i
in range(17)
.