backtesting.py icon indicating copy to clipboard operation
backtesting.py copied to clipboard

Fix read-only array error in FractionalBacktest indicator scaling

Open atharvajoshi01 opened this issue 7 months ago • 1 comments

Fixes the CI failure in test_FractionalBacktest where indicator /= self._fractional_unit raises ValueError: output array is read-only on newer pandas.

The in-place division fails because the underlying numpy array from pandas is read-only (copy-on-write). Replaced with a non-mutating division that creates a new array and updates the list entry directly.

Ref: #1354

atharvajoshi01 avatar Apr 28 '26 05:04 atharvajoshi01

still relevant. pandas copy-on-write is the default in 2.x, so indicator /= self._fractional_unit blows up with ValueError: output array is read-only on any current install. fix is the 2-line non-mutating swap, no behavior change.

atharvajoshi01 avatar Jun 08 '26 02:06 atharvajoshi01