AttributeError的:“浮动”对象有没有属性“申请”

问题描述 投票:-2回答:1
products['sentiment'] = products['rating'].apply(lambda rating : +1 if rating > 3 else -1)

它显示了同样的错误每次:

AttributeError的:“浮动”对象有没有属性“申请”

我使用python 3.7,你可以请帮忙解决这个问题?

python-3.x
1个回答
0
投票

貌似products['rating']float;试试这个来代替:

prodcuts['sentiment'] = 1 if products['rating'] > 3 else -1
© www.soinside.com 2019 - 2024. All rights reserved.