LoginSignup
0
0

TIL: pandas のデータ型について

Posted at

TIL:
・pandas で dtype が object のカラムには str 型と int 型が同居していることがある。
・自動で型推定される時のルールが把握できない。csv 上で同じカラムに同じ文字列「10」が入っている場合でも、 DataFrame に読み込んだら '10' (str) になるレコードと 10 (int) になるレコードがある。

→ マージのキーにしたいなど型まで一致してないといけない場合は dtype を与えるのが安全。

0
0
0

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
0
0