Value assignment by iloc overwrites multiple concat columns #12528
Labels
Duplicate Report
Duplicate issue or pull request
Indexing
Related to indexing on series/frames, not to indexes themselves
Suppose we wish to concatenate two dataframes with the same name. Because the columns share the same name, loc will not distinguish them. So we use iloc to manipulate them individually.
This gives the surprising output that the result on the first column is applied to both.
The expected output is this.
This could be achieved with this code (although that requires renaming the columns).
Why do we get a different result when we use iloc? I understand the renaming the column would matter if we were using loc. Please help me understand why iloc cares about column names.
I'm using pandas: 0.17.1, numpy: 1.9.2.
Thank you.
The text was updated successfully, but these errors were encountered: