Create new dataframe with minor changes

You should make a copy of value bound to df1 variable:

df2 = copy(df1)

df2 = df1 does not copy value. It just adds binding to the df2 name of a value bound to df1 name. This is discussed in Types · The Julia Language and additionally explained in chapter 2 of Julia for Data Analysis (the content should be available for you to view for free in the preview of the book).

A similar question is posted today for a second time so I also have written a post Values’ mutability in Julia | Blog by Bogumił Kamiński related to the issue of mutability (it covers a bit different aspect than = operator but I hope it will help you to understand the whole concept of mutable values better).

3 Likes