A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/9874 below:

Dictionary assignment with loc with existing index doesn't properly match column names in dict · Issue #9874 · pandas-dev/pandas · GitHub

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}

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4