Skip to content

ENH: df.assign accepting dependent **kwargs (#14207) #18852

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 10, 2018

Conversation

datajanko
Copy link
Contributor

@datajanko datajanko commented Dec 19, 2017

Specifically, 'df.assign(b=1, c=lambda x:x['b'])'
does not throw an exception in python 3.6 and above.
Further details are discussed in Issues #14207 and #18797.

closes #14207
closes #18797

  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

columns created within the same ``assign`` call. For python 3.6 and
above it is possible to reference columns created in an assignment.
To this end you have to respect the order of |*|*kwargs and use
callables referencing the assigned columns.
Copy link
Member

@gfyoung gfyoung Dec 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python --> Python
eralier --> earlier, <-- note the comma

Add comma after "To this end"
"|*|*kwargs" <-- what's this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I fear the |*|*kwargs part is an artifact of somewhere else, will also change the earlier typo

with pytest.raises(KeyError):
df.assign(C=df.A, D=lambda x: x['A'] + x['C'])
if not PY36:
with pytest.raises(KeyError):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add note as to why this is occurring. Also, I presume there is no real error message for this KeyError.


def test_assign_dependent(self):
df = DataFrame({'A': [1, 2], 'B': [3, 4]})
if PY36:
Copy link
Member

@gfyoung gfyoung Dec 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Reference issue number below function declaration
  • You might want to consider decorating with a test-skipper so that we don't run this test on anything below 3.6 (also no need to create the DataFrame if there's nothing afterwards).

@@ -139,6 +139,7 @@ Other Enhancements
- :func:`read_excel()` has gained the ``nrows`` parameter (:issue:`16645`)
- :func:``DataFrame.to_json`` and ``Series.to_json`` now accept an ``index`` argument which allows the user to exclude the index from the JSON output (:issue:`17394`)
- ``IntervalIndex.to_tuples()`` has gained the ``na_tuple`` parameter to control whether NA is returned as a tuple of NA, or NA itself (:issue:`18756`)
- :func:``DataFrame.assign()`` now acceepts dependent kwargs, e.g. `df.assign(b=1, c=lambda x:x['b'])` does not throw an exception anymore. (:issue: `14207)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previously this would raise (put the what it did raise), write the issue like

(:issue:`14207`)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also:

  • :func:``DataFrame.assign()`` --> :func:`DataFrame.assign` (single ticks, no parenthesis)
  • acceepts --> accepts
  • `df.assign(b=1, c=lambda x:x['b'])` --> ``df.assign(b=1, c=lambda x: x['b'])`` (double ticks)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be worth breaking this out into its own section and highlight a case where this is an API change. Something like

.. warning::

This may subtly change the behavior of your code when you're
using ``assign`` to update an existing column. Previously, callables
refering to other variables being updated would get the "old" values

.. code-block:: ipython

    In [2]: df = pd.DataFrame({"A": [1, 2, 3]})

    In [3]: df.assign(A=lambda df: df.A + 1, C=lambda df: df.A * -1)
    Out[3]:
        A  C
    0  2 -1
    1  3 -2
    2  4 -3

Now, callables will get the "new" value

.. ipython:: python

    df = pd.DataFrame({"A": [1, 2, 3]})
    df.assign(A=lambda df: df.A + 1, C=lambda df: df.A * -1)

results[k] = com._apply_if_callable(v, data)

# sort by key for 3.5 and earlier
results = sorted(results.items())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is incorrectly indented

with pytest.raises(KeyError):
df.assign(C=df.A, D=lambda x: x['A'] + x['C'])

def test_assign_dependent(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a skipif decorator here if not PY36

df.assign(C=lambda df: df.A, D=lambda df: df['A'] + df['C'])
with pytest.raises(KeyError):
df.assign(C=df.A, D=lambda x: x['A'] + x['C'])
if not PY36:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make this into a separate test (from the PY36) part and add a skipif PY36 decorator

@datajanko
Copy link
Contributor Author

thanks for the valuable feedback. If I want to recommit my pull request, is a rebase required or can I also just add a new commit with the appropriate changes. (Sorry I'm new to that). I think I will issue a new pull request (with the appropriate change) later today

@gfyoung
Copy link
Member

gfyoung commented Dec 20, 2017

@datajanko :

  1. Don't issue a new PR! You are more than welcome to push new changes to your current PR. The fewer PR's we have to review, the better 😄

  2. Making your PR merge-able is of secondary concern because your tests aren't passing. Once you get them to pass, then worry about it. For the time being, just keep pushing new commits.

@datajanko
Copy link
Contributor Author

The tests pass and hopefully I fixed the errors. However, in the whatsnew section the exception traceback is printed out (when I ran it) due different python versions. What could be done there to avoid printing the traceback?

@@ -119,6 +119,56 @@ Current Behavior

s.rank(na_option='top')

.. _whatsnew_0220.enhancements.assign_dependent:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebase on master. can you move to 0.23 (docs were renamed), prob easiest to just check this file from master and past in new one

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(also 0220 -> 0230)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll manage to rebase until Christmas.
the whatsnew page I constructed contains the traceback (since a change between python versions is shown) Is this desired? If not, is there a way to just print the code and output as in the document and not run the code actually?

@datajanko datajanko force-pushed the assign-chained-kwargs branch from f958371 to 469ed4c Compare December 23, 2017 20:53
@datajanko
Copy link
Contributor Author

I hopefully rebased correctly. Additionally, I could fix the "errors" in the whatsnew description and squashed all commits into one

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc comments. you don't need to squash fyi.

@@ -7,8 +7,3 @@ This is a major release from 0.21.1 and includes a number of API changes,
deprecations, new features, enhancements, and performance improvements along
with a large number of bug fixes. We recommend that all users upgrade to this
version.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert this file

``.assign()`` accepts dependent arguments
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The :func:`DataFrame.assign()` now accepts dependent kwargs. In earlier versions this throws a Keyerror exception anymore. (:issue: `14207)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to say what it did in prior version (here)


The :func:`DataFrame.assign()` now accepts dependent kwargs. In earlier versions this throws a Keyerror exception anymore. (:issue: `14207)

Specifically, defining a new column inside assign may be referenced in the same assign statement if a callable is used. For example
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.assign(); use double-backticks.


Specifically, defining a new column inside assign may be referenced in the same assign statement if a callable is used. For example

.. code-block:: ipython
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use an ipython block (this executes the code), you don't need to show the results they will be rendered when they execute

using ``assign`` to update an existing column. Previously, callables
refering to other variables being updated would get the "old" values

.. code-block:: ipython
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use a code block here as this is previous behavior

use
Previous Behaviour:

1 3 -2
2 4 -3

Now, callables will get the "new" value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New Behaviour:

Now, callables will get the "new" value

.. code-block:: ipython

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ipython block

``.assign()`` accepts dependent arguments
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The :func:`DataFrame.assign()` now accepts dependent kwargs. In earlier versions this throws a Keyerror exception anymore. (:issue: `14207)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put a reference to the doc-section on .assign in the docs which also needs updating.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, but what is the correct path to refer to? What should be the updated content of the .assign docs?


This may subtly change the behavior of your code when you're
using ``assign`` to update an existing column. Previously, callables
refering to other variables being updated would get the "old" values
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

referring

@codecov
Copy link

codecov bot commented Dec 24, 2017

Codecov Report

❗ No coverage uploaded for pull request base (master@5c76f33). Click here to learn what that means.
The diff coverage is 28.57%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #18852   +/-   ##
=========================================
  Coverage          ?   91.61%           
=========================================
  Files             ?      150           
  Lines             ?    48796           
  Branches          ?        0           
=========================================
  Hits              ?    44704           
  Misses            ?     4092           
  Partials          ?        0
Flag Coverage Δ
#multiple 89.98% <28.57%> (?)
#single 41.72% <28.57%> (?)
Impacted Files Coverage Δ
pandas/core/frame.py 97.17% <28.57%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c76f33...4184732. Read the comment docs.

@datajanko
Copy link
Contributor Author

Why is the coverage changing in only the documentation is changed?

@jreback
Copy link
Contributor

jreback commented Dec 27, 2017

coverage is a little bit bogus :<


Specifically, defining a new column inside ``.assign()`` may be referenced in the same assign statement if a callable is used. For example

.. ipython:: python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use ipython, then you don't need to show the code, it executes


Previous Behaviour:

.. code-block:: ipython
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this is correct here


New Behaviour:

.. ipython:: python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but you don't need all this, just

df.assign(....) # complete the line of course

generally we would simply execute and show the DataFrame creation in an ipython block at the top of the sub-section, then do a code-block for previous, and an ipython block for enw

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above


@pytest.mark.skipif(PY36, reason="""Issue #14207: valid for python
3.6 and above""")
def test_assign_bad_old_version(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you name this something more relevant

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean the name of the function or the reason?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name of the function


Specifically, defining a new column inside ``.assign()`` may be referenced in the same assign statement if a callable is used. For example

.. ipython:: python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls see how other things are formatted in the whatsnew.

you need only to do

.. ipython:: python

   df = pd.DataFrame({'A': [1, 2, 3]})
   df
   df.assign(B=df.A, C=lambda x: x['A'] + x['B'])

``.assign()`` accepts dependent arguments
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The :func:`DataFrame.assign()` now accepts dependent kwargs. (:issue:`14207`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a little more expl of what a dependenet kwarg is


New Behaviour:

.. ipython:: python
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The :func:`DataFrame.assign()` now accepts dependent kwargs for python version later than 3.6 (see also `PEP 468
<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`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use :func:`DataFrame.assign` here.


df = pd.DataFrame({'A': [1, 2, 3]})
df
df.assign(B=df.A, C=lambda x:x['A']+ x['B'])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent the same

results[k] = com._apply_if_callable(v, data)

# preserve order for 3.6 and later, but sort by key for 3.5 and earlier
# for 3.6 preserve order of kwargs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

say >= 3.6

else:
# for 3.5 or earlier: do all calculations first...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<= 3.5


.. warning::

This may subtly change the behavior of your code when you're
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add this warning to the main docs as well in dsintro.rst

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the Main docs? Docstring of the assign function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same ``assign`` call.
is possible, but for python 3.5 and earlier, you cannot reference
other columns created within the same ``assign`` call.
For python 3.6 and above it is possible to reference columns created
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and Python 3.6 and later
Python 3.5 and earlier

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would talk about 3.6 and later first, since they're the future.

Assigning multiple columns within the same ``assign`` is possible. For Python 3.6 and above, later items in '\*\*kwargs' may refer to newly created or modified columns in 'df'; items are computed and assigned into 'df' in order.  For Python 3.5 and below, the order of keyword arguments is not specified, you cannot refer to newly created or modified columns. All items are computed first, and then assigned in alphabetical order. 

This can replace the entire "Notes" section I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, could you add the example you've been using to the "Examples" section.

``.assign()`` accepts dependent arguments
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The :func:`DataFrame.assign()` now accepts dependent kwargs for python version later than 3.6 (see also `PEP 468
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"kwargs" -> "keyword arguments"

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The :func:`DataFrame.assign()` now accepts dependent kwargs for python version later than 3.6 (see also `PEP 468
<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`)
Copy link
Contributor

@TomAugspurger TomAugspurger Jan 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"keyword-value pairs" -> "keyword arguments".

I'm not sure if "predecessors" is the right word. How about

"Later keyword arguments may now refer to earlier ones. (:issue:`14207`)"

Copy link
Contributor Author

@datajanko datajanko Jan 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds indeed better. Should I drop the reference to callables? (Sorry, obviously my auto correct messed up)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe keep "callables", so

"Later keyword arguments may now refer to earlier ones if the argument is a callable. (:issue:`14207`)"

the same ``assign`` call.
is possible, but for python 3.5 and earlier, you cannot reference
other columns created within the same ``assign`` call.
For python 3.6 and above it is possible to reference columns created
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would talk about 3.6 and later first, since they're the future.

Assigning multiple columns within the same ``assign`` is possible. For Python 3.6 and above, later items in '\*\*kwargs' may refer to newly created or modified columns in 'df'; items are computed and assigned into 'df' in order.  For Python 3.5 and below, the order of keyword arguments is not specified, you cannot refer to newly created or modified columns. All items are computed first, and then assigned in alphabetical order. 

This can replace the entire "Notes" section I think.

the same ``assign`` call.
is possible, but for python 3.5 and earlier, you cannot reference
other columns created within the same ``assign`` call.
For python 3.6 and above it is possible to reference columns created
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, could you add the example you've been using to the "Examples" section.

@TomAugspurger
Copy link
Contributor

Could you add a

.. versionmodified :: 0.23.0
   Keyword argument order is maintained for Python 3.6 and later.

to https://github.com/pandas-dev/pandas/pull/18852/files#diff-1e79abbbdd150d4771b91ea60a4e1cc7R2648

@datajanko datajanko force-pushed the assign-chained-kwargs branch from 98ce484 to 75403c8 Compare January 9, 2018 21:45
@datajanko
Copy link
Contributor Author

datajanko commented Jan 10, 2018

Sorry, I am not sure why travis failed on some 3.5 builds. Any ideas? Maybe I messed something up when reading?

@gfyoung
Copy link
Member

gfyoung commented Jan 10, 2018

I restarted the builds to check, but you might need to rebase onto master. There has been some numpy weirdness lately (see d5194e5 from @TomAugspurger where we pinned numpy).

@datajanko
Copy link
Contributor Author

I saw some issues yesterday and already performed a rebase (I hope correctly). I think I know where the issues are coming from: I added an example in frame.py (as @TomAugspurger suggested) as a doctest which will only work for python 3.6 and above. Is it possible to skip the doctest for older python versions? If not can I post examples in the doctoring of a function also using restructured texts code-blocks?

@@ -507,9 +507,41 @@ of one argument to be called on the ``DataFrame``. A *copy* of the original
DataFrame is returned, with the new values inserted.

.. warning::
Starting from Python 3.6 ``**kwargs`` is an ordered dictionary and ``assign``
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use :func`DataFrame.assign`

@@ -507,9 +507,41 @@ of one argument to be called on the ``DataFrame``. A *copy* of the original
DataFrame is returned, with the new values inserted.

.. warning::
Starting from Python 3.6 ``**kwargs`` is an ordered dictionary and ``assign``
respects the order of the keyword arguments. It is allowed to write
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reword It is allowed to write

.. ipython::
:verbatim:

In [1]: # Allowed for Python 3.6 and later
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comments on a separate line. don't user verbatim, just write the expression

This may subtly change the behavior of your code when you're
using ``.assign()`` to update an existing column. Prior to Python 3.6,
callables referring to other variables being updated would get the "old" values

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This previous does not need to be here, ONLY in the whatsnew new

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove from here down

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so implicitly, if one uses pandas 0.23 it is assumed that also python >= 3.6, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why would you say that?

remove it because it is redundant (you said it above)

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 minor doc changes. ping on green.


All expressions are computed first, and then assigned. So you can't refer
to another column being assigned in the same call to ``assign``. For example:
In [1]: df.assign(C = lambda x: x['A'] + x['B'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when using an ipython:: python block, it executes the code, thus we cannot have the In [1]: there

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using a simple python:: block will always execute the code and yield errors since df is (currently) not defined appropriately. So - it seems - there are two possibilities to resolve this:

  1. use verbatim and just show the syntax of the call (which you refused in my last commit)
  2. use the iris DataFrame from the section or df from a section before and modify the call w.r.t those frames.

Which way to go?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best to just make a small dataframe for the example:

.. ipython:: python

   df = DataFrame({"A": [1, 2, 3],
                   "B": [4, 5, 6]})
   df.assign(C=lambda x: x['A'] + x['B'],
             D=lambda x: x['A'] + x['C'])

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Call it something other than df though, since creating a new df will break examples further down.

(df.assign(C = lambda x: x['A'] + x['B'])
.assign(D = lambda x: x['A'] + x['C']))
This may subtly change the behavior of your code when you're
using ``.assign()`` to update an existing column. Prior to Python 3.6,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:func:`DataFrame`

@jreback jreback added this to the 0.23.0 milestone Jan 13, 2018
@datajanko
Copy link
Contributor Author

so what is the next thing I should do in this pull request? some rebasing required? Or just sit back and wait?

@jreback
Copy link
Contributor

jreback commented Jan 15, 2018

@TomAugspurger if you'd verify this reads ok.

@datajanko
Copy link
Contributor Author

is there anything left I need to do?

@jreback
Copy link
Contributor

jreback commented Jan 31, 2018

can you rebase on master

@datajanko
Copy link
Contributor Author

just for clarification: rebasing the changes you made to my branch on the current master branch of pandas-dev? I think I will be able to manage this over the weekend

@jreback
Copy link
Contributor

jreback commented Feb 1, 2018

yes just rebase against master and push again

Specifically, 'df.assign(b=1, c=lambda x:x['b'])'
does not throw an exception in python 3.6 and above.
Further details are discussed in Issues pandas-dev#14207 and pandas-dev#18797.

populates dsintro and frame.py with examples and warning

- adds example to frame.py
- reworked warning in dsintro
- reworked Notes in frame.py

Remains open:

frame.py probably is responsible vor travis not passing: doc test that requires python 3.6
@datajanko datajanko force-pushed the assign-chained-kwargs branch from 25153d3 to b7ec738 Compare February 9, 2018 20:09
@datajanko
Copy link
Contributor Author

sorry, did the rebase just now. Had some urgent family matters to attend. Hope the rebase is correct.

@jreback jreback merged commit bae38fc into pandas-dev:master Feb 10, 2018
@jreback
Copy link
Contributor

jreback commented Feb 10, 2018

thanks!

@datajanko datajanko deleted the assign-chained-kwargs branch February 10, 2018 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suggestion: Make assign accepts list of dictionaries API: allow dependent assignment?
5 participants