0
이 스크립트는 다른 스택 오버플로 게시를 기반으로 작동하고 있으며 원하는 작업을 수행하는 데 너무 가깝습니다. 마지막 단계는 새 CSV를 인수로 추가하는 두 번째 위치에 저장하는 것입니다. 이 코드에서 "removed.csv"를 대상으로 바꾸고 싶지만 작동하지 않습니다. 소스 코드가있는 곳에서 저장하고 저장 위치를 지정하고 싶습니다. 누구든지 올바른 방향으로 나를 가리킬 수 있습니까? 정말 고마워!Python Pandas as pd set to_csv 위치
#!/usr/bin/python
import sys
import pandas as pd
filename = sys.argv[1]
destination = sys.argv[2]
df = pd.read_csv(filename)
keep_cols = ["Path", "IPTC - Title", "Description", "Person(s) of Import", "Museum Location", "Catalog Name", "Catalog Number", "Catalog Link", "Keywords", "Special Exhibitions", "Donor Credit", "Video Licensing", "Image Licensing", "Music Licensing", "Audio Licensing", "Relate Assets", "IPTC - Creator", "IPTC - City", "IPTC - Country", "Rights Usage Terms"]
new_df = df[keep_cols]
new_df.to_csv("removed.csv", index=False)
고마워요! 이것은 일했다 :) –