Skip to content
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

BUG #21374: Fix divison with complex numbers in eval() method #21472

Closed
wants to merge 2 commits into from
Closed

BUG #21374: Fix divison with complex numbers in eval() method #21472

wants to merge 2 commits into from

Conversation

fillipe-gsm
Copy link

@fillipe-gsm fillipe-gsm commented Jun 14, 2018

data = {"a": [1 + 2j], "b": [1 + 1j]}
df = pd.DataFrame(data = data)
df.eval("a/b")

Expected output:

df["a"]/df["b"]

0    (1.5+0.5j)
dtype: complex128

New result:

df.eval("a/b")

0    (1.5+0.5j)
dtype: complex128
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

…division in eval() without discarding imaginary part with complex data

closes #21374
@pep8speaks
Copy link

pep8speaks commented Jun 14, 2018

Hello @fillipe-gsm! Thanks for updating the PR.

Cheers ! There are no PEP8 issues in this Pull Request. 🍻

Comment last updated on June 14, 2018 at 02:15 Hours UTC

@codecov
Copy link

codecov bot commented Jun 14, 2018

Codecov Report

Merging #21472 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #21472      +/-   ##
==========================================
- Coverage    91.9%   91.89%   -0.01%     
==========================================
  Files         153      153              
  Lines       49606    49606              
==========================================
- Hits        45589    45587       -2     
- Misses       4017     4019       +2
Flag Coverage Δ
#multiple 90.29% <100%> (-0.01%) ⬇️
#single 41.89% <0%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/computation/ops.py 95.6% <100%> (ø) ⬆️
pandas/util/testing.py 84.6% <0%> (-0.21%) ⬇️

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 b5fc769...72252e1. Read the comment docs.

@jreback
Copy link
Contributor

jreback commented Jun 14, 2018

tests!

@jreback jreback added Bug Numeric Operations Arithmetic, Comparison, and Logical operations labels Jun 14, 2018
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.

needs tests and a whatsnew entry (bug fix in numeric), can be in 0.23.2

@jbrockmendel
Copy link
Member

@fillipe-gsm this is almost ready, just needs a unit test and what’s new entry.

@jreback
Copy link
Contributor

jreback commented Sep 25, 2018

closing. needs tests. pls ping if able to update.

@jreback jreback closed this Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pd.eval() discards imaginary part in division "/"
4 participants