question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

REGR: DataFrame.eval not respecting inplace argument in pandas 1.4

See original GitHub issue
import 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:closed
  • Created a year ago
  • Reactions:2
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jorisvandenbosschecommented, Aug 12, 2022

@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)

0reactions
Yikuncommented, Aug 12, 2022

@jorisvandenbossche Thanks for your info!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found