1

I think because pandas return a view of a dataframe when you manipulate a column out of your DataFrame it will affect on your original DataFrame but when i run first code it changes the column as it should but in second one it wont and i cant explain why ?! can anyone explain this to me ?

costs = df['Cost']
costs += 2
costs = df['Cost']
costs = costs + 2

thanks in advance

Matal7
  • 11
  • 1

0 Answers0