可以帮我 解释一下红字的意思吗 以及怎么改正 以下是部分代码 和错误 十分感谢!
csv文件中没有 月份这一列?
望采纳:
我看了你的错误:没有这个键值。
你的运行输入是5,然而5对应的函数是需要导入CSV文件的。函数中第二行是col_1 = data[‘月份’]
所以得出结论,代码可能没有问题,是你导入的数据有问题,看看数据集里有没有月份key
chatroom_friends = getChatroomFriends(chatrooms, friend_overlap)
#% 置换username为名称
result_chatroom_friends = copy.deepcopy(chatroom_friends)
for k in result_chatroom_friends:
usernames = result_chatroom_friends[k]['friends']
result_chatroom_friends[k]['friends'] = ' | '.join(friend_overlap.loc[usernames]['RemarkName'].tolist())
result_chatroom_friends = pd.DataFrame(result_chatroom_friends).T
result_chatroom_friends = result_chatroom_friends[['total', 'num', 'friends']]
# 数据用完,处理friend_overlap
friend_overlap = getSameChatroomInfo(chatroom_friends, friend_overlap)