簡體   English   中英

如何修復此錯誤:AttributeError: 'numpy.ndarray' object has no attribute 'apply'

[英]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 DataFramesSeries對象具有apply 使用 numpy,您可以調用np.apply_along_axis但我認為這段代碼可能最初預期message是 pandas Series

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM