Skip to content

.ix[] inconsistently assigns right hand side #4508

Closed
@etyurin

Description

@etyurin

This is with pandas 0.12.0.dev-be25266:

In [1]: import pandas as pd

In [2]: df = pd.DataFrame({'a':[1,2,3],'b':[0,1,2]})

In [3]: df.ix[[0,2,],'b'] = [100,-100] # Works as intended

In [4]: print df
a b
0 1 100
1 2 1
2 3 -100

In [6]: df = pd.DataFrame({'a':range(4)})

In [7]: df['b']=pd.np.nan

In [8]: df.ix[[1,3],'b'] = [100,-100] # Both rows get assigned 100

In [9]: print df
a b
0 0 NaN
1 1 100
2 2 NaN
3 3 100

In [10]: df['b'].ix[[1,3]] = [100,-100] # Works as intended

In [11]: print df
a b
0 0 NaN
1 1 100
2 2 NaN
3 3 -100

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions