I was confused because I could not immediately change the two columns using .loc[:,['A', 'B'] , which I think because it returns a copy instead of a view. I cannot find in Indexing and Data Selection the final guide on when it will return the view and when it will return the copy.
I use pandas 0.18, I see that in the old version of the documentation (pandas 0.13) she said: "Whenever an array of labels or a Boolean vector is involved in the indexing operation, the result will be a copy", but I can not find it in the current documentation
pd.__version__
None of them raise a SettingWithCopy warning. So I'm a little confused about why the purpose of df2.loc[:, ['A', 'B']] has no effect.
On closer inspection, I see that this is not a copy , since in another test I assigned a dataframe with different values ββand I was βsavedβ in df2 , but dtypes df2 cannot be βsetβ through the destination .loc[:, ['A', 'B']] .
Is there a reason why the assignment .loc[:, ['A', 'B']] = does not change dtypes and [['A', 'B']] = does?
source share