Skip to content

assigning using df.loc and unsorted labels doesn't put values in the right places #6254

@sadruddin

Description

@sadruddin

Using 0.13.1 (gohlke binaries, Win64, using numpy 1.8):

When using .loc, when passing unsorted labels, pandas doesn't assign the values in the designed labels' locations. Example:
df = pandas.DataFrame(index=[3, 5, 4], columns=['A'])
df.loc[[4, 3, 5], 'A'] = [1, 2, 3]
Result is:

Out[30]: 
   A
3  1
5  2
4  3

One would have expected:

Out[30]: 
   A
3  2
5  3
4  1

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions