You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a =DataFrame(x=[1,1])
b =DataFrame(x=[1], y=[[1,2,3]])
leftjoin!(a, b, on=:x)
deleteat!(a[1,:y], 1)
println(a)
And out of surprise, you would see that both vectors in the y column got updated ([1,2,3] -> [2,3])! If I iterate over each row using eachrow, then changing the first row would also affect the second row. I don't know whether it is a desired behavior (I am sure in Pandas it does not behave like this), and I am wondering what to do if I only want to change the first vector in the y column.
Thanks!
The text was updated successfully, but these errors were encountered:
mzy2240
changed the title
leftjoin! use reference instead of data?!
leftjoin! is actually copying reference instead of value?!
Sep 13, 2023
MWE:
And out of surprise, you would see that both vectors in the y column got updated (
[1,2,3]
->[2,3]
)! If I iterate over each row usingeachrow
, then changing the first row would also affect the second row. I don't know whether it is a desired behavior (I am sure in Pandas it does not behave like this), and I am wondering what to do if I only want to change the first vector in the y column.Thanks!
The text was updated successfully, but these errors were encountered: