Skip to content

Commit 8983c5d

Browse files
mroeschkehoxbro
andauthored
Backport PR #53175: Add np.intc to _factorizers in pd.merge (#53276)
Co-authored-by: Simon Høxbro Hansen <[email protected]>
1 parent a23c15c commit 8983c5d

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

doc/source/whatsnew/v2.0.2.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ including other versions of pandas.
1414
Fixed regressions
1515
~~~~~~~~~~~~~~~~~
1616
- Fixed performance regression in :meth:`GroupBy.apply` (:issue:`53195`)
17+
- Fixed regression in :func:`merge` on Windows when dtype is ``np.intc`` (:issue:`52451`)
1718
- Fixed regression in :func:`read_sql` dropping columns with duplicated column names (:issue:`53117`)
1819
- Fixed regression in :meth:`DataFrame.loc` losing :class:`MultiIndex` name when enlarging object (:issue:`53053`)
1920
- Fixed regression in :meth:`DataFrame.to_string` printing a backslash at the end of the first row of data, instead of headers, when the DataFrame doesn't fit the line width (:issue:`53054`)
2021
- Fixed regression in :meth:`MultiIndex.join` returning levels in wrong order (:issue:`53093`)
21-
-
2222

2323
.. ---------------------------------------------------------------------------
2424
.. _whatsnew_202.bug_fixes:

pandas/core/reshape/merge.py

+4
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@
123123
np.object_: libhashtable.ObjectFactorizer,
124124
}
125125

126+
# See https://github.com/pandas-dev/pandas/issues/52451
127+
if np.intc is not np.int32:
128+
_factorizers[np.intc] = libhashtable.Int64Factorizer
129+
126130

127131
@Substitution("\nleft : DataFrame or named Series")
128132
@Appender(_merge_doc, indents=0)

pandas/tests/reshape/merge/test_merge.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,9 @@ def test_different(self, right_vals):
14631463
result = merge(left, right, on="A")
14641464
assert is_object_dtype(result.A.dtype)
14651465

1466-
@pytest.mark.parametrize("d1", [np.int64, np.int32, np.int16, np.int8, np.uint8])
1466+
@pytest.mark.parametrize(
1467+
"d1", [np.int64, np.int32, np.intc, np.int16, np.int8, np.uint8]
1468+
)
14671469
@pytest.mark.parametrize("d2", [np.int64, np.float64, np.float32, np.float16])
14681470
def test_join_multi_dtypes(self, d1, d2):
14691471
dtype1 = np.dtype(d1)

0 commit comments

Comments
 (0)