Skip to content

Commit 08ebc18

Browse files
author
datajanko
committed
improves whatsnew on ipython block and explanation of dependent kwargs
1 parent 2feb54d commit 08ebc18

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

doc/source/whatsnew/v0.23.0.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,15 @@ Current Behavior
125125
``.assign()`` accepts dependent arguments
126126
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
127127

128-
The :func:`DataFrame.assign()` now accepts dependent kwargs. (:issue:`14207`)
128+
The :func:`DataFrame.assign()` now accepts dependent kwargs for python version later than 3.6 (see also `PEP 468
129+
<https://www.python.org/dev/peps/pep-0468/>`_). Now the keyword-value pairs passed to `.assign()` may depend on their predecessors if the values are callables. (:issue:`14207`)
129130

130-
Specifically, defining a new column inside ``.assign()`` may be referenced in the same assign statement if a callable is used. For example
131+
.. ipython:: python
131132

132-
.. ipython:: python
133+
df = pd.DataFrame({'A': [1, 2, 3]})
134+
df
135+
df.assign(B=df.A, C=lambda x:x['A']+ x['B'])
133136

134-
In [3]: df = pd.DataFrame({'A': [1, 2, 3]})
135-
136-
In [4]: df.assign(B=df.A, C=lambda x:x['A']+ x['B'])
137137
.. warning::
138138

139139
This may subtly change the behavior of your code when you're
@@ -157,7 +157,7 @@ New Behaviour:
157157

158158
.. ipython:: python
159159

160-
In [5]: df.assign(A=df.A+1, C= lambda df: df.A* -1)
160+
df.assign(A=df.A+1, C= lambda df: df.A* -1)
161161

162162

163163
.. _whatsnew_0230.enhancements.other:

0 commit comments

Comments
 (0)