Skip to content

Inappropriate/inconsistent behavior in data assignment (v. 0.13) #6043

Closed
@cyrusmaher

Description

@cyrusmaher

I find it convenient to store lists or series as elements in a dataframe. However, it seems panda gets confused if the iterable is the same length as the number of rows in the dataframe. Here's a minimal example:

matchmat_test = pd.DataFrame(index=[0,1], 
                             columns=[1], dtype=list)
matchmat_test.ix[0,0] = [1,2,3]

Returns:

           0
0  [1, 2, 3]
1        NaN

If we then assign to the same element again:

matchmat_test.ix[0,0] = [1,2]

we get:

 0
0  1
1  2

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