Open s1162276945 opened 6 years ago
in python3, you currently have to import dill as pickle https://stackoverflow.com/questions/25348532/can-python-pickle-lambda-functions
改成dill读取也是不行的,修改如下,把lambda换成apply就行了 def numerize(tp):
# sid = map(lambda x: item2id[x], tp['item_id'])
tp['user_id'] = tp['user_id'].apply(lambda x:user2id[x])
tp['item_id'] = tp['item_id'].apply(lambda x:item2id[x])
return tp
改成dill读取也是不行的,修改如下,把lambda换成apply就行了 def numerize(tp):
uid = map(lambda x: user2id[x], tp['user_id'])
sid = map(lambda x: item2id[x], tp['item_id'])
tp['user_id'] = tp['user_id'].apply(lambda x:user2id[x]) tp['item_id'] = tp['item_id'].apply(lambda x:item2id[x]) return tp
code: t.apply(lambda p: str(p.name)) for t in train_folders[0].glob("*.png") error: AttributeError: 'WindowsPath' object has no attribute 'apply' how to solve the error????
DeepCoNN/pro_data/loaddata.py 运行不了,报的是pickle 错误 print(item_reviews[11]) pickle.dump(user_reviews, open(os.path.join(TPS_DIR, 'user_review'), 'wb'))