0

My data frame is dff, and it has columns named 'amount'.I am using the following comands:

dff.amount[(dff['amount']<5)]=0

it gives the following error:

SettingWithCopyWarning:  A value is trying to be set on a copy of a slice from a DataFrame 

What is the reason?

Shota
  • 11
  • 3

1 Answers1

0

Try this:

import numpy as np
dff.amount = np.where(dff['amount']<5, 0, dff.amount)
gtomer
  • 5,643
  • 1
  • 10
  • 21