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")
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme