LoginSignup
3
3

More than 3 years have passed since last update.

pandasのfillnaを使ったときの「TypeError: No matching signature found」エラーへの対処法

Posted at

こんな人におすすめ

  • pythonのdf.fillna(method = "ffill")を使ったときに「TypeError: No matching signature found」がでて困っている人

対処法

df.fillna(method="ffill")

で「TypeError: No matching signature found」のエラーが発生した場合、下記のように修正すれば良い。

df.astype("object").fillna(method="ffill")

一度object形式に変換してからfillnaを適用する。
上記のエラーは型が異なるときに発生するエラーらしい。
fillnaのあとはintなりfloatなりに再度astypeするのを忘れずに。
floatにする場合は下記。

df.astype("object").fillna(method="ffill").astype("float")
3
3
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
3
3