You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there might be a bug in the assignment to a DataFrame object through .ix when non-unique MultiIndexes are involved. The next sample code describes this issue:
In [1]: from pandas import DataFrame, MultiIndex
In [2]:
In [2]: df = DataFrame([[1, 1, "x", "X"], [1, 1, "y", "Y"], [1, 2, "z", "Z"]],
...: columns=list("ABCD"))
In [3]: df = df.set_index(list("AB"))
In [4]: df
Out[4]:
C D
A B
1 1 x X
1 y Y
2 z Z
In [5]:
In [5]: ix = MultiIndex.from_tuples([(1, 1)])
In [6]: df.ix[ix, "C"] # Shows both values with index (1, 1)
Out[6]:
A B
1 1 x
1 y
Name: C
In [7]:
In [7]: df.ix[ix, "C"] = "_" # Only sets one of the two values with index (1, 1): BUG?
In [8]: df
Out[8]:
C D
A B
1 1 x X
1 _ Y
2 z Z
Thanks and regards.
Manu.
The text was updated successfully, but these errors were encountered:
Hi,
I think there might be a bug in the assignment to a DataFrame object through .ix when non-unique MultiIndexes are involved. The next sample code describes this issue:
Thanks and regards.
Manu.
The text was updated successfully, but these errors were encountered: