关于数据挖掘:字典的键值转换直接给df对象的列赋值列表

36次阅读

共计 261 个字符,预计需要花费 1 分钟才能阅读完成。

word2tf = {'秦朝':15,'鸡腿':200,'大西瓜':500}
tf2word = {v:k for k,v in word2tf.items()}
tf2word 

ceshi = pd.DataFrame({'ceshi':[np.array([123]),np.array([456]),np.array([789])]})
ceshi['ceshi'] = [(i+1) for i in ceshi['ceshi']]
[(i+1) for i in ceshi['ceshi']]
ceshi['ceshi'] = [1,2,3]
print(ceshi) 

正文完
 0