Dictionary assignment with loc with existing index doesn't properly match column names in dict · Issue #9874 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
uses the example DataFrame from #9857.
In [3]: df = pd.DataFrame({'x': [1,2,6], 'y': [2,2,8], 'z':[-5,0,5]})
In [4]: df = df.set_index('z')
In [5]: rhs = {'x': 9, 'y': 99}
In [6]: df.loc[5] Out[6]: x 6 y 8 Name: 5, dtype: int64
In [7]: df.loc[5] = rhs
In [8]: df Out[8]: x y z -5 1 2 0 2 2 5 {u'y': 99, u'x': 9} {u'y': 99, u'x': 9}