我想重塑一個向量到一個數組的Python NumPy的:重塑已被棄用
myArray = np.reshape(myVector,[nCol,nRow])
但我得到一個警告折舊:
FutureWarning: reshape is deprecated and will raise in a subsequent release. Please use .values.reshape(...) instead
return reshape(newshape, order=order)
當我使用
myArray = np.values.reshape(myVector,[nCol,nRow])
我收到一條錯誤
AttributeError: module 'numpy' has no attribute 'values'
請有人可以解釋發生了什麼,我應該做什麼?非常感謝
這不是numpy的警告。 'myVector'是一個熊貓物體嗎? –
@WarrenWeckesser是的,myVector是來自更大數據框的一列。對不起,我忽略了 – jlt199
你需要在重塑它之前訪問numpy數組對象然後'np.reshape(myVector.values,(nCol,nRow))' – Psidom