-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
API: multi-line, not inplace eval #11149
Conversation
@@ -1256,6 +1256,44 @@ def f(): | |||
expected['c'] = expected['a'] + expected['b'] | |||
assert_frame_equal(df, expected) | |||
|
|||
def test_multi_line_expression(self): | |||
df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the issue as a comment
@chris-b1 this looks reasonable. I think that we should change the make yes? |
cc @shoyer |
Yes, this looks great! I agree that we should change the default behavior to |
dd580c1
to
ba84151
Compare
@chris-b1 going to mark this for 0.18.0 as putting the deprecation warning in-place (pun intended) |
@chris-b1 want to update / add in deprecation warning as discussed |
ba84151
to
15a423e
Compare
@jreback - this is updated - added a whatsnew and deprecation warnings. |
|
||
WARNING: inplace=None currently falls back to to True, but | ||
in a future version, will default to False. Use inplace=True | ||
explicitly rather than relying on the default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's add .assign in the See also (as .assign is basically what df.eval('c=a+b',inplace=False)
IS)
pls review the eval docs for any updates (in enhancingperf.rst) |
does this handle #8664 ? |
identifier. | ||
|
||
The ``inplace`` keyword determines whether this assignment will performed | ||
on the original ``DataFrame`` or return a copy with the new column. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a versionadded
tag for inplace
f5cd30b
to
765b855
Compare
@@ -2048,6 +2048,9 @@ def query(self, expr, **kwargs): | |||
The query string to evaluate. You can refer to variables | |||
in the environment by prefixing them with an '@' character like | |||
``@a + b``. | |||
inplace : bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add a versionadded
lgtm. couple of doc changes. squash & ping when green. |
Updated for your doc comment and PEP8 - nothing major but did have to add a couple |
merged via 99c2d93 thanks for the nice changes! yeh the |
Deprecated back in 0.18.0 xref pandas-devgh-11149
Deprecated back in 0.18.0 xref pandas-devgh-11149 [ci skip]
Deprecated back in 0.18.0 xref pandas-devgh-11149 [ci skip]
Deprecated back in 0.18.0 xref pandas-devgh-11149 [ci skip]
Deprecated in 0.18.0. xref pandas-devgh-11149. Also patches bug where we were improperly handling the inplace=False condition, as we were assuming that target input was non-None when that wasn't necessarily enforced.
Deprecated in 0.18.0. xref pandas-devgh-11149. Also patches bug where we were improperly handling the inplace=False condition, as we were assuming that target input was non-None when that wasn't necessarily enforced.
Deprecated in 0.18.0. xref pandas-devgh-11149. Also patches bug where we were improperly handling the inplace=False condition, as we were assuming that target input was non-None when that wasn't necessarily enforced.
Deprecated in 0.18.0. xref pandas-devgh-11149. Also patches bug where we were improperly handling the inplace=False condition, as we were assuming that target input was non-None when that wasn't necessarily enforced.
Deprecated in 0.18.0. xref pandas-devgh-11149. Also patches bug where we were improperly handling the inplace=False condition, as we were assuming that target input was non-None when that wasn't necessarily enforced.
Deprecated in 0.18.0. xref pandas-devgh-11149. Also patches bug where we were improperly handling the inplace=False condition, as we were assuming that target input was non-None when that wasn't necessarily enforced.
Deprecated in 0.18.0. xref pandas-devgh-11149. Also patches bug where we were improperly handling the inplace=False condition, as we were assuming that target input was non-None when that wasn't necessarily enforced.
Deprecated in 0.18.0. xref pandas-devgh-11149. Also patches bug where we were improperly handling the inplace=False condition, as we were assuming that target input was non-None when that wasn't necessarily enforced.
Deprecated in 0.18.0. xref pandas-devgh-11149. Also patches bug where we were improperly handling the inplace=False condition, as we were assuming that target input was non-None when that wasn't necessarily enforced.
Deprecated in 0.18.0. xref pandas-devgh-11149. Also patches bug where we were improperly handling the inplace=False condition, as we were assuming that target input was non-None when that wasn't necessarily enforced.
Deprecated in 0.18.0. xref pandas-devgh-11149. Also patches bug where we were improperly handling the inplace=False condition, as we were assuming that target input was non-None when that wasn't necessarily enforced.
Deprecated in 0.18.0. xref pandas-devgh-11149. Also patches bug where we were improperly handling the inplace=False condition, as we were assuming that target input was non-None when that wasn't necessarily enforced.
Deprecated in 0.18.0. xref pandas-devgh-11149. Also patches bug where we were improperly handling the inplace=False condition, as we were assuming that target input was non-None when that wasn't necessarily enforced.
* COMPAT: pandas TimeGrouper xref pandas-dev/pandas#16747 * COMPAT: For pandas 0.21 CategoricalDtype * COMPAT: For pandas 0.21.0 HTML repr changes pandas-dev/pandas#16879 * COMPAT: For pandas 0.21.0 numexpr import pandas-dev/pandas#17710 * COMPAT: Default for inplace is now False in eval pandas-dev/pandas#11149
closes #9297
closes #8664
This is just a proof of concept at this point - the idea is to allow multiple assignments within an eval block, and also include an
inplace
argument (currently default True to match old behavior, although maybe that should be changed) for chaining.