Skip to content

Commit 6f58ad7

Browse files
committed
Fix mypy and array manager test
1 parent 74cb8b5 commit 6f58ad7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3837,7 +3837,7 @@ def _getitem_multilevel(self, key):
38373837
new_values, index=self.index, columns=result_columns
38383838
)
38393839
if using_copy_on_write() and isinstance(loc, slice):
3840-
result._mgr.add_references(self._mgr)
3840+
result._mgr.add_references(self._mgr) # type: ignore[arg-type]
38413841

38423842
result = result.__finalize__(self)
38433843

pandas/tests/copy_view/test_indexing.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,15 +1036,16 @@ def test_set_value_copy_only_necessary_column(
10361036
assert np.shares_memory(get_array(df, "a"), get_array(view, "a"))
10371037

10381038

1039-
def test_getitem_midx_slice(using_copy_on_write):
1039+
def test_getitem_midx_slice(using_copy_on_write, using_array_manager):
10401040
df = DataFrame({("a", "x"): [1, 2], ("a", "y"): 1, ("b", "x"): 2})
10411041
df_orig = df.copy()
10421042
new_df = df[("a",)]
10431043

10441044
if using_copy_on_write:
10451045
assert not new_df._mgr._has_no_reference(0)
10461046

1047-
assert np.shares_memory(get_array(df, ("a", "x")), get_array(new_df, "x"))
1047+
if not using_array_manager:
1048+
assert np.shares_memory(get_array(df, ("a", "x")), get_array(new_df, "x"))
10481049
if using_copy_on_write:
10491050
new_df.iloc[0, 0] = 100
10501051
tm.assert_frame_equal(df_orig, df)

0 commit comments

Comments
 (0)