字典的键值转换,直接给df对象的列赋值列表

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

字典的键值转换,直接给df对象的列赋值列表_第1张图片

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) 

字典的键值转换,直接给df对象的列赋值列表_第2张图片

你可能感兴趣的:(数据挖掘机器学习)