Pandas列值排列

huangapple go评论60阅读模式
英文:

Pandas column value arrangement

问题

我有关于Google Play统计数据的数据,而“安装”列的值让我失败了。它们是如10.000+的形式,我想要去掉所有值中的“+”号。我可以怎么做?有没有pandas的技巧?

英文:

I have a data about google play statistic and the Insatalls column values make me failed.It is like 10.000+ and I want to get rid of "+" for all values. What can I do ? Is there any pandas trick ?

答案1

得分: 2

使用这段代码来去除右侧的'+'符号:

df['Installs'] = df['Installs'].str.rstrip('+')
英文:

Use this code to strip '+' on right ends

df['Installs'] = df['Installs'].str.rstrip('+')

答案2

得分: 0

df['Installs'] = df['Installs'].apply(lambda x: x.rstrip('+'))

英文:
df['Installs'] = df['Installs'].apply(lambda x: x.rstrip('+'))

huangapple
  • 本文由 发表于 2020年1月7日 02:45:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/59617356.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定