0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

CSVファイル内の重複行の削除

0
Posted at
import pandas as pd


def remove_duplicates(filename):
    df = pd.read_csv(filename)

    # 重複行を削除
    df = df.drop_duplicates()

    # 元ファイルに上書き
    df.to_csv(filename, index=False)


if __name__ == "__main__":
    remove_duplicates("input.csv")
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?