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

DataFrame.eval error fixed #59145

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Riyazul555
Copy link

@Riyazul555 Riyazul555 commented Jun 29, 2024

@@ -218,3 +217,12 @@ def reconstruct_object(typ, obj, axes, dtype):
ret_value = np.array([ret_value]).astype(res_t)

return ret_value

# Test with the DataFrame and multiline expression
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 move the test to a proper test file? I think pandas/tests/test_expressions.py is probably the best place for it.

@@ -144,8 +145,6 @@ def _align_core(terms):
obj = ti.reindex(reindexer, axis=axis)
terms[i].update(obj)

terms[i].update(terms[i].value.values)
Copy link
Contributor

@chaoyihu chaoyihu Jul 1, 2024

Choose a reason for hiding this comment

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

Removing this line does fix the bug, nice job! But I'm curious about potential side effects: this line of code converts terms[i].value from pd.Series to np.ndarray, and removing it might affect the behavior of terms in whatever context it is used. Are the test failures related?

Copy link
Author

Choose a reason for hiding this comment

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

Sure @chaoyihu I have added the test in the respective file
But here what you want me to do further in this terms[i].value ??

@Riyazul555
Copy link
Author

I have moved the test in the respective file
Do check it out @chaoyihu and let me know about terms[i].value .....what you want me o do further?
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: DataFrame.eval fails with TypeError with multiline expr but works when eval line by line
3 participants