I am trying to modify some cells' values by multiplying by 10 . and it doesn't work. Here is a simple code example: Thank you so much for help
a={'name':['john','eric','kate'],'buy':[100,50,200],'sell':[20,30,40]}
df=pd.DataFrame(a)
df
name buy sell
0 john 100 20
1 eric 50 30
2 kate 200 40
df[df['name']=='eric'].iloc[:,2:]=df[df['name']=='eric'].iloc[:,2:]*10
df
name buy sell
0 john 100 20
1 eric 50 30
2 kate 200 40
but if I do this by modifying all the row values, then it is fine, so what is the problem of above code when using row filtering? Thank you so much for your help
df.iloc[:,2:]=df.iloc[:,2:]*10
df
name buy sell
0 john 100 200
1 eric 50 300
2 kate 200 400