IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boo
生活随笔
收集整理的這篇文章主要介紹了
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boo
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
錯誤提示:
IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indices
原因:
圖像像素的x,y下標必須為整型數字,不能為浮點數(帶小數),而我這有小數
解決辦法:
將生成數字的代碼加個int()函數即可
總結
以上是生活随笔為你收集整理的IndexError: only integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boo的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【放置奇兵】tips(神圣伤害)
- 下一篇: numpy矩阵计算GPU加速库:cupy