LoginSignup
1
2

More than 3 years have passed since last update.

pandasで地味に使う書き方

Last updated at Posted at 2020-05-13

データフレームの並び替え

#デフォルトは昇順
newdf = df.sort_values(["column1","column2"])

#降順にするにはascending = Falseをつける
newdf = df.sort_values(["column1","column2"], ascending = [True, False])

欠損値の処理

#欠損値を0で埋めるケース
newdf = df.fillna(0)

#欠損値の列毎の集計方法
df.isnull().sum()

#欠損値の行だけ抽出
df[df.isnull() == True]
1
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
1
2