IndexError:arrays used as indices must be of integer (or boolean) type问题解决

用numpy.ndarray类型作为index操作时,报错:IndexError:arrays used as indices must be of integer (or boolean) type,解决办法:

将numpy.ndarray对象加上:   要操作的array.astype('int64')

astype的作用是修改array元素的类型。

posted @ 2018-06-15 14:48  lzp的bky  阅读(11477)  评论(0编辑  收藏  举报