LoginSignup
1
1

More than 5 years have passed since last update.

Pandasメモ

Posted at

リサンプル時に補間する

時系列データを伸ばす方向にリサンプルすると補間が行われずにNaNが入る(デフォルト)。
fill_methodオプションで埋めるようにする。

df = pandas.read_csv(f, fill_method='pad')

NaNの行を削除する

df.dropna(how='all', inplace=True)  # inplace=Trueで自己破壊的な処理をする

重複を削除する

# 自己破壊処理
df.drop_duplicates(inplace=True)

# 指定したカラムを処理
df.drop_duplicates('timestamp')

# 重複値で残す値を選択
df.drop_duplicates('timestamp', keep='last')
1
1
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
1