import pandas as pd
import xlwt
df = pd.read_excel('input.xls')
print(df)
df = df.drop(['IDCONTRATTO', 'IDHARDWARE', 'DATAEVENTO'], axis=1)
print(df)
df.to_excel('output.xls')
-----------------------------
# Then I edited the script to get param from a Input folder and move it to a "OutDir" folder. (just because I needed this, it sucks but it is the way I had to do it.)
import shutil
import pandas as pd
import sys
import xlwt
inputFile = str(sys.argv[1])
print(inputFile)
df = pd.read_excel(inputFile)
print(df)
df = df.drop(['IDCONTRATTO', 'IDHARDWARE', 'DATAEVENTO'], axis=1)
print(df)
filename = inputFile.split("/")
outputFile = filename[1]
df.to_excel(outputFile)
shutil.move(outputFile,"OutDir")
Nessun commento:
Posta un commento