成功解決IndexError: shape mismatch: indexing arrays could not be broadcast together with shapes (100,)

成功解決IndexError: shape mismatch: indexing arrays could not be broadcast together with shapes (100,)html

 

 

 

 

 

目錄數組

解決問題ide

解決思路htm

解決方法索引


 

 

 

 

 

解決問題

Index Error: shape mismatch: indexing arrays could not be broadcast together with shapes (100,) (100,10) ip

 

 

 

 

解決思路

索引錯誤:形狀不匹配:索引數組沒法與形狀(100,)一塊兒廣播(100,10)。
當使用其餘整數類型的多維數組,訪問numpy多維數組時,用於索引的數組須要具備相同的形狀。numpy將會被容許去廣播(若是可能的話),因此,若要爲了實現這一點,數組須要具備相同的維數。ci

參考文章
Stack overflow:shape mismatch: indexing arrays could not be broadcast together with shapes
Indexing Multi-dimensional arraysget

 

 

 

 

解決方法

使兩個numpy數組保持形狀一致便可!it

相關文章
相關標籤/搜索