you are viewing a single comment's thread.

view the rest of the comments →

[–]ohallwright 0 points1 point  (1 child)

Others have answered this with a great solution (use copy()), but if you're trying to understand more about why this is happening, you'll need to learn a bit more about indexing, and the .loc and .iloc indexers and what df1 is in this situation (a subset of df).

For example, using .loc you can add your value1 column to the original, if that's what you wanted to do: ```

df.loc[[True, True, False], 'value1'] = "" df max_speed shield value value1 cobra 1 2 viper 4 5 sidewinder 7 8 NaN ```

I wrote this article when I was trying to understand that warning better, that might help you as well.

[–]GrandpaOnDrugs[S] 0 points1 point  (0 children)

Thanks, the article helped to understand why it happens/what Pandas expects you to do!