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

FIX-#4672: Fix incorrect warning when setting frame.columns or frame.index #4721

Merged
merged 1 commit into from
Jul 27, 2022

Conversation

jbrockmendel
Copy link
Collaborator

@jbrockmendel jbrockmendel commented Jul 26, 2022

Signed-off-by: Brock jbrockmendel@gmail.com

What do these changes do?

Stop emitting incorrect warning.

@codecov
Copy link

codecov bot commented Jul 26, 2022

Codecov Report

Merging #4721 (7341590) into master (49c0398) will decrease coverage by 9.26%.
The diff coverage is 100.00%.

❗ Current head 7341590 differs from pull request most recent head f7f01e9. Consider uploading reports for the commit f7f01e9 to get more accurate results

@@            Coverage Diff             @@
##           master    #4721      +/-   ##
==========================================
- Coverage   85.13%   75.87%   -9.27%     
==========================================
  Files         259      259              
  Lines       19211    19222      +11     
==========================================
- Hits        16356    14584    -1772     
- Misses       2855     4638    +1783     
Impacted Files Coverage Δ
modin/pandas/dataframe.py 67.20% <100.00%> (-24.57%) ⬇️
modin/experimental/sklearn/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
modin/experimental/xgboost/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
modin/experimental/xgboost/test/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
modin/experimental/xgboost/test/test_dmatrix.py 0.00% <0.00%> (-100.00%) ⬇️
modin/experimental/xgboost/test/test_xgboost.py 0.00% <0.00%> (-100.00%) ⬇️
modin/experimental/core/execution/ray/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
...n/experimental/sklearn/model_selection/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
...mental/sklearn/model_selection/train_test_split.py 0.00% <0.00%> (-100.00%) ⬇️
...tal/core/execution/ray/implementations/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
... and 91 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

Copy link
Collaborator

@mvashishtha mvashishtha left a comment

Choose a reason for hiding this comment

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

@jbrockmendel thank you so much for fixing this. I have a minor comment.

modin/pandas/test/dataframe/test_default.py Outdated Show resolved Hide resolved
mvashishtha
mvashishtha previously approved these changes Jul 26, 2022
Copy link
Collaborator

@mvashishtha mvashishtha left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment on lines 1179 to 1188
with pytest.warns(None):
df.index = ["foo", "bar"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

pytest.warns(None) doesn't check that we're not warning, so this test case doesn't reproduce the bug. The recommended solution is to use warnings.catch_warnings() and warnings.simplefilter("error"). I just checked that that reproduces the bug.

Suggested change
with pytest.warns(None):
df.index = ["foo", "bar"]
with warnings.catch_warnings():
warnings.simplefilter("error")
df.index = ["foo", "bar"]

You'll also have to import warnings at the top of the file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

could use pandas.testing.assert_produces_warning(None):

Copy link
Collaborator

Choose a reason for hiding this comment

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

looks like assert_produces_warning doesn't live in pandas.testing anymore, and it was moved to pandas/_testing. I guess we should use catch_warnings after all.

mvashishtha
mvashishtha previously approved these changes Jul 27, 2022
…mns or frame index

Signed-off-by: Brock <jbrockmendel@gmail.com>
@mvashishtha mvashishtha merged commit 23c40a6 into modin-project:master Jul 27, 2022
YarShev pushed a commit to YarShev/modin that referenced this pull request Jul 31, 2022
…mns or frame index (modin-project#4721)

Signed-off-by: Brock <jbrockmendel@gmail.com>
YarShev pushed a commit that referenced this pull request Sep 6, 2022
…index (#4721)

Signed-off-by: Brock <jbrockmendel@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants