REGR: DataFrame.eval not respecting inplace argument in pandas 1.4
See original GitHub issueimport pandas as pd
import numpy as np
# Example for eval
pdf = pd.DataFrame({"A": range(1, 6), "B": range(10, 0, -2), "C": range(11, 16)})
pser = pdf.A
pdf.eval("A = B + C", inplace=True)
# pser != pdf.A after 1.4
_Originally posted by @Yikun in https://github.com/pandas-dev/pandas/issues/47188#issuecomment-1148168713_
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:7 (7 by maintainers)
Top Results From Across the Web
What's new in 1.4.0 (January 22, 2022) - Pandas
DataFrame.to_stata() and StataWriter() now accept the keyword only argument value_labels to save labels for non-categorical columns (GH38454).
Read more >pandas.DataFrame.eval — pandas 1.5.2 documentation
Evaluate a string describing operations on DataFrame columns. Operates on columns only, not specific rows or elements. This allows eval to run arbitrary ......
Read more >Essential basic functionality — pandas 1.5.2 documentation
If a DataFrame contains homogeneously-typed data, the ndarray can actually be modified in-place, and the changes will be reflected in the data structure....
Read more >powerful Python data analysis toolkit - pandas
1.4.1.3 .to_datetime() has gained an origin parameter . ... 1.4.2.7. Concat of different float dtypes will not automatically upcast .
Read more >pandas.eval — pandas 1.5.2 documentation
Evaluate a Python expression as a string using various backends. The following arithmetic operations are supported: + , - , * , / ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Yikun we are fixing this in https://github.com/pandas-dev/pandas/pull/47550, but in general I would recommend to not rely on this too much (updating Series by performing inplace on the DataFrame). There are plans to change that behaviour (https://github.com/pandas-dev/pandas/issues/36195), and actually also to deprecate the inplace keyword (https://github.com/pandas-dev/pandas/issues/16529)
@jorisvandenbossche Thanks for your info!