2

I need modulo query because the data is to long and need to show in one screen only. Here's my dataset

     Name
1    they
2    ulti
3    they
4    set
5    djhd
6    tdh
7    t473

What I need is, 1 modulo 3 in this case

     Name
1    they
4    set
7    t473
Nabih Bawazir
  • 6,381
  • 7
  • 37
  • 70

1 Answers1

3

Use boolean indexing with modulo 3:

df = df[df.index % 3 == 1]
print (df)
   Name
1  they
4   set
7  t473

Detail:

print (df.index % 3 )
Int64Index([1, 2, 0, 1, 2, 0, 1], dtype='int64')
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252