Skip to content

Instantly share code, notes, and snippets.

@espoirMur
Created December 12, 2017 19:05
Show Gist options
  • Save espoirMur/c2a8c13346c975830ecc889042b5d38f to your computer and use it in GitHub Desktop.
Save espoirMur/c2a8c13346c975830ecc889042b5d38f to your computer and use it in GitHub Desktop.
waterfall bio rade
#################### INPUT FILES #############
Tk().withdraw()
files = tkFileDialog.askopenfilenames()
lst = list(files)
dataframe = pd.DataFrame()
for FileName in lst:
df = pd.read_excel(str(FileName))
#add this to remove white spaces in the Vehicle columns
df.Vehicle = df.Vehicle.apply(lambda x : x.replace(" ", ""))
dataframe = dataframe.append(df, ignore_index=True)
print dataframe
Parameter= eval(raw_input ("Enter the SKU: "))
#dataframe1 = dataframe[('Vehicle')] == "003-MM09XBP"
dataframe1 = dataframe[dataframe.Vehicle == Parameter]
print type(dataframe1)
print dataframe1
#groups = dataframe.groupby(Parameter)
################# DESTINATION FILE #################
writer = ExcelWriter ('waterfall_SKUnumber.xlsx')
dataframe1.to_excel(writer ,index=False,sheet_name= str(Parameter))
writer.save()
##############################################
#Accessing workbook and worksheet
workbook = writer.book
worksheet = writer.sheets[str(Parameter)]
writer.save()
#########################################
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment