Issue
I have a dataframe such as :
COL1 COL2 COL3
A B C
D E F
G G I
J K L
M N O
P Q R
S T U
V W X
Y Z A
and I would like to keep only intervals of 3 rows. I should then get :
COL1 COL2 COL3
G G I
P Q R
Y Z A
Does someone have an idea?
Solution
You can use .iloc
and range:
df.iloc[range(2,len(df),3)]
Answered By - Youssef_boughanmi
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.