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: Fixes pd.merge issue with columns of dtype numpy.uintc on windows #60145

Merged
merged 11 commits into from
Nov 1, 2024

Conversation

AbhishekChaudharii
Copy link
Contributor

@AbhishekChaudharii AbhishekChaudharii commented Oct 30, 2024

This PR fixes the issue encountered when using pd.merge with columns of dtype numpy.uintc on windows.
Added a relevant pytest case to validate correct behavior.

Comment on lines 1847 to 1848
"""To test if pd.merge works with numpy.uintc on windows"""

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"""To test if pd.merge works with numpy.uintc on windows"""

We don't use docstrings in our tests

def test_merge_with_uintc_columns(dataframes_with_uintc):
"""To test if pd.merge works with numpy.uintc on windows"""

df1 = pd.DataFrame({"a": ["foo", "bar"], "b": np.array([1, 2], dtype=np.uintc)})
Copy link
Member

Choose a reason for hiding this comment

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

Do we have tests with np.intc as well?

@@ -1843,6 +1843,20 @@ def test_merge_empty(self, left_empty, how, exp):

tm.assert_frame_equal(result, expected)

def test_merge_with_uintc_columns(dataframes_with_uintc):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def test_merge_with_uintc_columns(dataframes_with_uintc):
def test_merge_with_uintc_columns():

Looks like that fixture wasn't used

Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

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

Could you also add a whatsnew note in v3.0.0.rst in the Reshaping section?

@mroeschke mroeschke added Reshaping Concat, Merge/Join, Stack/Unstack, Explode Window rolling, ewma, expanding labels Oct 30, 2024
@AbhishekChaudharii
Copy link
Contributor Author

Hi @mroeschke , I have added the whatsnew note and included current issue #58713 and also issue #60091 as this PR fixes both of them. I have also added 2 more test cases which includes np.intc and reproducible example from issue #60091

@@ -592,7 +592,6 @@ Performance improvements
- Performance improvement in :meth:`RangeIndex.take` returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57445`, :issue:`57752`)
- Performance improvement in :func:`merge` if hash-join can be used (:issue:`57970`)
- Performance improvement in :meth:`CategoricalDtype.update_dtype` when ``dtype`` is a :class:`CategoricalDtype` with non ``None`` categories and ordered (:issue:`59647`)
- Performance improvement in :meth:`DataFrame.astype` when converting to extension floating dtypes, e.g. "Float64" (:issue:`60066`)
Copy link
Member

Choose a reason for hiding this comment

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

Don't think this should have been removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry It accidentally got deleted while running a git command. Thank you for catching it

AbhishekChaudharii and others added 3 commits November 1, 2024 11:53
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
@mroeschke mroeschke added this to the 3.0 milestone Nov 1, 2024
@mroeschke mroeschke merged commit a3f14bf into pandas-dev:main Nov 1, 2024
50 of 51 checks passed
@mroeschke
Copy link
Member

Thanks @AbhishekChaudharii

@AbhishekChaudharii AbhishekChaudharii deleted the issue_58713 branch November 20, 2024 07:32
keitaroyam added a commit to keitaroyam/servalcat that referenced this pull request Dec 2, 2024
keitaroyam added a commit to keitaroyam/servalcat that referenced this pull request Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reshaping Concat, Merge/Join, Stack/Unstack, Explode Window rolling, ewma, expanding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: pd.merge fail with numpy.uintc on Windows
2 participants