用numpy.ndarray类型作为index操作时,报错:IndexError:arrays used as indices must be of integer (or boolean) type,解决办法:
将numpy.ndarray对象加上: 要操作的array.astype('int64')
astype的作用是修改array元素的类型。
用numpy.ndarray类型作为index操作时,报错:IndexError:arrays used as indices must be of integer (or boolean) type,解决办法:
将numpy.ndarray对象加上: 要操作的array.astype('int64')
astype的作用是修改array元素的类型。