Panel slice assigning does not reindex correctly? · Issue #1630 · pandas-dev/pandas (original) (raw)

Suppose I have

a=Panel(randn(3,10,2))
b=Series(randn(10))
b.sort()

now the index of b has a different order, yet same values as the major_index of a

if I do

a.ix[0,:,0]=b

the slice of a gets assigned the values of b without reindexing first, but somehow the index is till kept track of:

b
Out[220]: 
4   -2.465417
8   -2.202345
3   -1.173703
5   -0.802436
7   -0.307515
0   -0.045943
1    0.155771
6    0.367755
9    0.458332
2    1.629641

a.ix[0,:,0]=b

a.ix[0,:,0]
Out[223]: 
0   -2.465417
1   -2.202345
2   -1.173703
3   -0.802436
4   -0.307515
5   -0.045943
6    0.155771
7    0.367755
8    0.458332
9    1.629641

a.ix[0,:,0]==b
Out[224]: 
0    True
1    True
2    True
3    True
4    True
5    True
6    True
7    True
8    True
9    True