From b804512fcebd27701948802334910bb685565df0 Mon Sep 17 00:00:00 2001 From: Sean Law Date: Thu, 22 Jan 2026 22:23:12 -0500 Subject: [PATCH 1/2] Fixed #1119 Pandas to NumPy array read-only error --- stumpy/core.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stumpy/core.py b/stumpy/core.py index 4f286f706..01bcfb834 100644 --- a/stumpy/core.py +++ b/stumpy/core.py @@ -2133,6 +2133,9 @@ def _preprocess(T, copy=True): T = transpose_dataframe(T) + if "pandas" in str(type(T)): + T = T.to_numpy(copy=True) + if "polars" in str(type(T)): T = T.to_numpy(writable=True) From 614b08f87010cee11c3cde93880249911f13c2f8 Mon Sep 17 00:00:00 2001 From: Sean Law Date: Fri, 23 Jan 2026 00:22:39 -0500 Subject: [PATCH 2/2] Updated docstrings --- stumpy/core.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/stumpy/core.py b/stumpy/core.py index 01bcfb834..5ee2a709d 100644 --- a/stumpy/core.py +++ b/stumpy/core.py @@ -2117,8 +2117,9 @@ def _preprocess(T, copy=True): Time series or sequence copy : bool, default True - A boolean value that indicates whether the process should be done on - input `T` (False) or its copy (True). + A boolean value that indicates whether the process should be performed on + input array `T` (False) or its copy (True). If `T` is a dataframe, then the + data is always copied into a brand new array. Returns ------- @@ -2173,8 +2174,9 @@ def preprocess( Window size copy : bool, default True - A boolean value that indicates whether the process should be done on - input `T` (False) or its copy (True). + A boolean value that indicates whether the process should be performed on + input array `T` (False) or its copy (True). If `T` is a dataframe, then the + data is always copied into a brand new array. M_T : numpy.ndarray, default None Rolling mean @@ -2236,8 +2238,9 @@ def preprocess_non_normalized(T, m, copy=True): Window size copy : bool, default True - A boolean value that indicates whether the process should be done on - input `T` (False) or its copy (True). + A boolean value that indicates whether the process should be performed on + input array `T` (False) or its copy (True). If `T` is a dataframe, then the + data is always copied into a brand new array. Returns ------- @@ -2296,8 +2299,9 @@ def preprocess_diagonal( corresponding value set to False in this boolean array. copy : bool, default True - A boolean value that indicates whether the process should be done on - input `T` (False) or its copy (True). + A boolean value that indicates whether the process should be performed on + input array `T` (False) or its copy (True). If `T` is a dataframe, then the + data is always copied into a brand new array. Returns -------