Skip to content

Commit b37745e

Browse files
committed
Add whatsnew
1 parent dd16c45 commit b37745e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

doc/source/whatsnew/v1.1.0.rst

+29
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,35 @@ Indexing
161161
- Bug in :meth:`DatetimeIndex.get_loc` raising ``KeyError`` with converted-integer key instead of the user-passed key (:issue:`31425`)
162162
- Bug in :meth:`Series.xs` incorrectly returning ``Timestamp`` instead of ``datetime64`` in some object-dtype cases (:issue:`31630`)
163163

164+
Assignment to multiple columns of a DataFrame when some columns do not exist
165+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
166+
167+
Assignment to multiple columns of a :class:`DataFrame` when some of the columns do not exist would previously assign the values to the last column. Now, new columns would be constructed with the right values. (:issue:`13658`)
168+
169+
.. ipython:: python
170+
171+
df = pd.DataFrame({'a': [0, 1, 2], 'b': [3, 4, 5]})
172+
df
173+
174+
*Previous behavior*:
175+
176+
.. code-block:: ipython
177+
178+
In [3]: df[['a', 'c']] = 1
179+
In [4]: df
180+
Out[4]:
181+
a b
182+
0 1 1
183+
1 1 1
184+
2 1 1
185+
186+
*New behavior*:
187+
188+
.. ipython:: python
189+
190+
df[['a', 'c']] = 1
191+
df
192+
164193
Missing
165194
^^^^^^^
166195

0 commit comments

Comments
 (0)