I have the following case:
df.iloc[:,1:6].plot(kind='box')
df.iloc[:,6:11].plot(kind='box')
df.iloc[:,11:16].plot(kind='box')
df.iloc[:,16:21].plot(kind='box')
df.iloc[:,21:26].plot(kind='box')
df.iloc[:,27:32].plot(kind='box')
df.iloc[:,33:38].plot(kind='box')
df.iloc[:,38:43].plot(kind='box')
df.iloc[:,43:48].plot(kind='box')
df.iloc[:,48:53].plot(kind='box')
I was trying to figure out the for loop
for such case
Would that possible?
CodePudding user response:
You can use:
for i in range(1, df.shape[1] 1, 5):
df.iloc[:,i:i 5].plot(kind='box')
NB. this skips the first column, if you want to start from it:
for i in range(0, df.shape[1], 5):
df.iloc[:,i:i 5].plot(kind='box')