Skip to content

TST: GH26650, added new test to validate numpy matmul function with dataframes #47427

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

Merged
merged 6 commits into from
Jun 21, 2022

Conversation

carbonleakage
Copy link
Contributor

@phofl
Copy link
Member

phofl commented Jun 20, 2022

Please let the reviewer resolve the conversations

# GH26650
data = [-1, 1, 10]
df = pd.DataFrame({"nums": data})
dfT = df.T
Copy link
Member

Choose a reason for hiding this comment

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

Please avoid these functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for reviewing and the feedback. I removed these lines and declared everything directly on the assert statement. Just for my understanding, these lines needed to be removed since they introduce too many variables?

Copy link
Member

Choose a reason for hiding this comment

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

No, we try to define tests in a way that they do not rely on functions that are not tested itself. E.g. .T was not necessary to reproduce the behavior.

You can do it like:

df=...
result=...
expected=...
arm.assert_frame_equal(result, expected)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh ok, I see. Thanks again! I modified the PR to reflect this.

Copy link
Member

@phofl phofl left a comment

Choose a reason for hiding this comment

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

lgtm

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Jun 21, 2022
@mroeschke mroeschke added this to the 1.5 milestone Jun 21, 2022
@mroeschke mroeschke merged commit f7c8fc8 into pandas-dev:main Jun 21, 2022
@mroeschke
Copy link
Member

Thanks @carbonleakage

@carbonleakage
Copy link
Contributor Author

Thanks @mroeschke and @phofl!

@carbonleakage carbonleakage deleted the issue_26650 branch June 22, 2022 19:58
yehoshuadimarsky pushed a commit to yehoshuadimarsky/pandas that referenced this pull request Jul 13, 2022
…ataframes (pandas-dev#47427)

* TST: GH26650, added new test to validate numpy matmul function with dataframes as inputs

* TST: GH26650, updated variable names

* Updated based on PR feedback

* Removed variable initialisations per feedback

* Final updates to PR

* Update pandas/tests/series/test_ufunc.py

Co-authored-by: Matthew Roeschke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle numpy.matmul in DataFrame.__array_ufunc__
3 participants