![](/img/trans.png)
[英]how to fix this error : numpy.ndarray “ object has no attribute ”append"
[英]How to fix this error :AttributeError: 'numpy.ndarray' object has no attribute 'apply'
如何在flask框架中使用下面的代碼,因為當我使用下面的代碼時,總是得到這個錯誤“AttributeError: 'numpy.ndarray' object has no attribute 'apply'”
message = message.apply(lambda x: ' '.join([word for word in x.split() if len(word) > 4]))
您收到錯誤是因為numpy.ndarray
沒有apply
屬性( docs )。 Pandas DataFrames
和Series
對象具有apply
。 使用 numpy,您可以調用np.apply_along_axis
但我認為這段代碼可能最初預期message
是 pandas Series
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.