0

In this case n=100

Here's my dataset

id   amount
1    1000
2    2000
3    2300.7632
4    4560

What I want is

id   amount
3    2300.7632
4    4560
Bonifacio2
  • 3,405
  • 6
  • 34
  • 54
Nabih Ibrahim Bawazir
  • 631
  • 2
  • 15
  • 27

3 Answers3

5

Use boolean indexing with modulo %:

df = df[df['amount'] % 100 != 0]
print (df)
   id     amount
2   3  2300.7632
3   4  4560.0000

Same as:

df = df[df['amount'].mod(100).ne(0)]
print (df)
   id     amount
2   3  2300.7632
3   4  4560.0000

Detail:

print (df['amount'].mod(100))
0     0.0000
1     0.0000
2     0.7632
3    60.0000
Name: amount, dtype: float64

It is practically implemented this answer in pandas.

jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252
3

Use

In [1787]: df[(df.amount % 100).astype(bool)]
Out[1787]:
   id     amount
2   3  2300.7632
3   4  4560.0000
Zero
  • 74,117
  • 18
  • 147
  • 154
2
In [79]: d[d.amount % 100 > 0]
Out[79]:
   id     amount
2   3  2300.7632
3   4  4560.0000
MaxU - stand with Ukraine
  • 205,989
  • 36
  • 386
  • 419