Skip to content

Commit db7faa6

Browse files
pre-commit automatic changes and also made changes to test_merge.py file to make pandas namespace consistent
1 parent d61de2e commit db7faa6

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,10 +736,10 @@ Reshaping
736736
- Bug in :meth:`DataFrame.join` when a :class:`DataFrame` with a :class:`MultiIndex` would raise an ``AssertionError`` when :attr:`MultiIndex.names` contained ``None``. (:issue:`58721`)
737737
- Bug in :meth:`DataFrame.merge` where merging on a column containing only ``NaN`` values resulted in an out-of-bounds array access (:issue:`59421`)
738738
- Bug in :meth:`DataFrame.unstack` producing incorrect results when ``sort=False`` (:issue:`54987`, :issue:`55516`)
739+
- Bug in :meth:`DataFrame.merge` when merging two dataframes with column dtype as numpy.intc resulting in ValueError: Buffer dtype mismatch, Only on windows (:issue:`60091`)
740+
- Bug in :meth:`DataFrame.merge` when merging two dataframes with column dtype as numpy.uintc resulting in KeyError: <class 'numpy.uintc'> ,Only on windows (:issue:`58713`)
739741
- Bug in :meth:`DataFrame.pivot_table` incorrectly subaggregating results when called without an ``index`` argument (:issue:`58722`)
740742
- Bug in :meth:`DataFrame.unstack` producing incorrect results when manipulating empty :class:`DataFrame` with an :class:`ExtentionDtype` (:issue:`59123`)
741-
- Bug in :meth:`DataFrame.merge` when merging two dataframes with column dtype as numpy.uintc resulting in KeyError: <class 'numpy.uintc'> ,Only on windows (:issue:`58713`)
742-
- Bug in :meth:`DataFrame.merge` when merging two dataframes with column dtype as numpy.intc resulting in ValueError: Buffer dtype mismatch, Only on windows (:issue:`60091`)
743743

744744
Sparse
745745
^^^^^^

pandas/tests/reshape/merge/test_merge.py

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,42 +1844,40 @@ def test_merge_empty(self, left_empty, how, exp):
18441844
tm.assert_frame_equal(result, expected)
18451845

18461846
def test_merge_with_uintc_columns(self):
1847-
df1 = pd.DataFrame({"a": ["foo", "bar"], "b": np.array([1, 2], dtype=np.uintc)})
1848-
df2 = pd.DataFrame({"a": ["foo", "baz"], "b": np.array([3, 4], dtype=np.uintc)})
1847+
df1 = DataFrame({"a": ["foo", "bar"], "b": np.array([1, 2], dtype=np.uintc)})
1848+
df2 = DataFrame({"a": ["foo", "baz"], "b": np.array([3, 4], dtype=np.uintc)})
18491849
result = df1.merge(df2, how="outer")
1850-
expected = pd.DataFrame(
1850+
expected = DataFrame(
18511851
{
18521852
"a": ["bar", "baz", "foo", "foo"],
18531853
"b": np.array([2, 4, 1, 3], dtype=np.uintc),
18541854
}
18551855
)
18561856
tm.assert_frame_equal(result.reset_index(drop=True), expected)
1857-
1857+
18581858
def test_merge_with_intc_columns(self):
1859-
df1 = pd.DataFrame({"a": ["foo", "bar"], "b": np.array([1, 2], dtype=np.intc)})
1860-
df2 = pd.DataFrame({"a": ["foo", "baz"], "b": np.array([3, 4], dtype=np.intc)})
1859+
df1 = DataFrame({"a": ["foo", "bar"], "b": np.array([1, 2], dtype=np.intc)})
1860+
df2 = DataFrame({"a": ["foo", "baz"], "b": np.array([3, 4], dtype=np.intc)})
18611861
result = df1.merge(df2, how="outer")
1862-
expected = pd.DataFrame(
1862+
expected = DataFrame(
18631863
{
18641864
"a": ["bar", "baz", "foo", "foo"],
18651865
"b": np.array([2, 4, 1, 3], dtype=np.intc),
18661866
}
18671867
)
18681868
tm.assert_frame_equal(result.reset_index(drop=True), expected)
1869-
1869+
18701870
def test_merge_intc_non_monotonic(self):
1871-
df = pd.DataFrame({"join_key": pd.Series([0, 2, 1], dtype=np.intc)})
1872-
df_details = pd.DataFrame({"join_key": pd.Series([0, 1, 2], dtype=np.intc),"value": ["a", "b", "c"]})
1873-
merged = pd.merge(df, df_details, on="join_key", how="left")
1874-
expected = pd.DataFrame(
1875-
{
1876-
'join_key':np.array([0,2,1],dtype=np.intc),
1877-
'value':['a','c','b']
1878-
}
1871+
df = DataFrame({"join_key": Series([0, 2, 1], dtype=np.intc)})
1872+
df_details = DataFrame(
1873+
{"join_key": Series([0, 1, 2], dtype=np.intc), "value": ["a", "b", "c"]}
18791874
)
1880-
tm.assert_frame_equal(merged.reset_index(drop=True),expected)
1881-
1882-
1875+
# merged = pd.merge(df, df_details, on="join_key", how="left")
1876+
merged = df.merge(df_details, on="join_key", how="left")
1877+
expected = DataFrame(
1878+
{"join_key": np.array([0, 2, 1], dtype=np.intc), "value": ["a", "c", "b"]}
1879+
)
1880+
tm.assert_frame_equal(merged.reset_index(drop=True), expected)
18831881

18841882

18851883
@pytest.fixture

0 commit comments

Comments
 (0)