I just attempted the following and was surprised that my original table was modified. I would have expected filter to allocate a new DataFrame so that setdiff! would not have modified the original DataFrame. I also tried view=false (which is the default), but the original table is mutated. Is this a bug?
That’s an interesting observation. DataFrames uses copy for these sorts of things rather than deepcopy. I wouldn’t call this a bug, necessarily, but it is something to look out for.
I am using it in simulation and am storing an initial state in the dataframe that gets updated. I guess, we don’t necessarily need to implement a deepcopy option, but the docstring could be updated to indicate that the new dataframe that is allocated is done by using copy rather than deepcopy.
Everywhere in the docstring where copycols is supported we write that we copy columns (not deepcopy).
If you think clarifying this would be helpful can you please make a PR to the manual (not to the documentation since we have very many places where the same issue is present) in a place where you think it would be most useful for you? Thank you!