While changing order of columns of a pandas dataframe couple of techniques are given.
- By reassigning the rearranged columns
df = df[['d', 'c', 'b', 'a']]
as given here
or
- By calling
DataFrame.reindex(columns=neworderlist)
as given here
The question is whether any of these listed techniques creates copies of the dataframe internally? Is any one of the techniques preferred over the other? A vague reference is given in pandas indexing documentation which discourages chained assignments. Does this 'SettingWithCopy' behaviour arise here as well?