我有数据帧
site1 site2 site3 site4 site5 site6 site7 site8 site9 site10
session_id
21669 56 55 0 0 0 0 0 0 0 0
54843 56 55 56 55 0 0 0 0 0 0
77292 946 946 951 946 946 945 948 784 949 946
114021 945 948 949 948 945 946 947 945 946 946
146670 947 950 948 947 950 952 946 951 946 947
我有json
^{pr2}$我试图用
site_dict_upd = {y:x for x,y in site_dict.iteritems()}
full_sites_names = pd.DataFrame()
full_sites_names = [full_sites[col].map(site_dict) for col in sites]
但它返回所有NaN值。 我该怎么解决呢?在
另一种方法是使用
applymap
:编辑
或者按照coldspeed的建议:
^{pr2}$我认为您需要^{} ,如果不需要替换,请将值转换为相同的
types
:只需使用
.replace
方法:相关问题 更多 >
编程相关推荐