We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 047acde commit 0fb84aeCopy full SHA for 0fb84ae
pandas/tests/copy_view/test_clip.py
@@ -0,0 +1,21 @@
1
+import numpy as np
2
+
3
+from pandas import DataFrame
4
+import pandas._testing as tm
5
+from pandas.tests.copy_view.util import get_array
6
7
8
+def test_clip_inplace_reference(using_copy_on_write):
9
+ df = DataFrame({"a": [1.5, 2, 3]})
10
+ df_copy = df.copy()
11
+ arr_a = get_array(df, "a")
12
+ view = df[:]
13
+ df.clip(lower=2, inplace=True)
14
15
+ # Clip not actually inplace right now but could be
16
+ assert not np.shares_memory(get_array(df, "a"), arr_a)
17
18
+ if using_copy_on_write:
19
+ assert df._mgr._has_no_reference(0)
20
+ assert view._mgr._has_no_reference(0)
21
+ tm.assert_frame_equal(df_copy, view)
0 commit comments