2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

pandas従業員総数欠損値補完

Posted at

従業員総数が記載された有価証券報告書は年に1回しかでないため,従業員数総数に欠損値が出る.
そこで,間の欠損を補完しようと思います!
今回は,前期の従業員数を参照するように補完を行いました.

現状

スクリーンショット 2019-12-28 12.19.18.png

目標
スクリーンショット 2019-12-28 12.22.40.png

df['従業員総数'] = df.groupby(['ティッカー'])['従業員総数'].apply(lambda d: d.fillna(d.interpolate(method='pad', limit=3)))
2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?