LoginSignup
13
14

More than 5 years have passed since last update.

PandasのDataFrameでカンマ区切りの数字文字列を数値にする

Last updated at Posted at 2016-12-13

はじめに

PandasのDataFrameで25,000のように、3桁ごとにカンマで区切られている文字列を、数値に変更したいとおもい調べました。

コード

df.apply(lambda x: x.str.replace(',','')).astype(np.int)

参考ページ

pandas – some ways to replace part of a string.

ありがとうございました。
他のやり方ありましたら、ご教授頂けるとありがたいです。

13
14
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
14