【发布时间】:2019-09-29 12:13:46
【问题描述】:
在 jupyter notebook 和 python 中,当我更改作为另一个数组副本的数组值时,它会影响原始数组。这不方便给我用。
我在 jupyter 笔记本上尝试过以下代码,我正在更改 arr_temp[1] 数组的值。但它会影响 原始 numpy 数组 .
import numpy as np
array = np.array([1,5,6,7,8,94])
array[4:6]
arr_temp = array[4:6]
arr_temp[1]=100
array
我期待array([ 1, 5, 6, 7, 8, 94]),但我得到的值是array([ 1, 5, 6, 7, 8, 100])。
【问题讨论】:
标签: python arrays numpy jupyter-notebook