Skip to content

Commit 325982c

Browse files
committed
BUG: copy certain interpolate arguments to ensure we can write to them;
closes #7295.
1 parent 4db22f4 commit 325982c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pandas/core/common.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,6 +1538,14 @@ def _interpolate_scipy_wrapper(x, y, new_x, method, fill_value=None,
15381538
terp = interpolate.UnivariateSpline(x, y, k=order)
15391539
new_y = terp(new_x)
15401540
else:
1541+
# GH 7295: need to be able to write for some reason
1542+
# in some circumstances: check all three
1543+
if not x.flags.writeable:
1544+
x = x.copy()
1545+
if not y.flags.writeable:
1546+
y = y.copy()
1547+
if not new_x.flags.writeable:
1548+
new_x = new_x.copy()
15411549
method = alt_methods[method]
15421550
new_y = method(x, y, new_x)
15431551
return new_y

0 commit comments

Comments
 (0)