We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 230180c commit 31d7d72Copy full SHA for 31d7d72
pandas/tests/copy_view/test_array.py
@@ -1,6 +1,8 @@
1
import numpy as np
2
import pytest
3
4
+from pandas.compat.numpy import np_version_gt2
5
+
6
from pandas import (
7
DataFrame,
8
Series,
@@ -138,8 +140,11 @@ def test_dataframe_multiple_numpy_dtypes():
138
140
assert not np.shares_memory(arr, get_array(df, "a"))
139
141
assert arr.flags.writeable is True
142
- with pytest.raises(ValueError, match="Unable to avoid copy while creating"):
- arr = np.array(df, copy=False)
143
+ if not np_version_gt2:
144
+ # copy=False semantics are only supported in NumPy>=2.
145
146
+ with pytest.raises(ValueError, match="Unable to avoid copy while creating"):
147
+ arr = np.array(df, copy=False)
148
149
arr = np.array(df, copy=True)
150
0 commit comments