码迷,mamicode.com
首页 > 其他好文 > 详细

利用map对pandas中带有万的字符处理

时间:2018-03-22 10:56:22      阅读:184      评论:0      收藏:0      [点我收藏+]

标签:oat   替换   class   png   alt   bubuko   return   post   http   

技术分享图片

目标,对后几列中带有“万”的的内容进行替换,如3.5万变成35000的形式。

def if_wan(x):
    if  in str(x):
        x=float(x[:-1])*10000
    return x
for i in names[2:]:
    data[i]=data[i].map(if_wan)

结果:

技术分享图片

 

利用map对pandas中带有万的字符处理

标签:oat   替换   class   png   alt   bubuko   return   post   http   

原文地址:https://www.cnblogs.com/daqina/p/8621434.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!