![]() |
all_data.append not work it should be - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: all_data.append not work it should be (/thread-6577.html) |
all_data.append not work it should be - issac_n - Nov-29-2017 ![]() ![]() currently I am trying to use "all_data.append" to append all xlsx files into one file , it return result but returned result is not complete, i cant identify where are the errors. errors sported 1)returned result not complete ![]() 2) why i cant label the path G? ![]() code as below; master1 = Tk() P = str() G = str() Label(master1, text="Folder Location :",width=20).grid(row=0) def OpenFile2(): master1.filename = filedialog.askdirectory() G = os.path.normpath(master1.filename) P = os.path.isdir(G)#check print("\n", P,"\n", G) #check Button(master1, text ="OpenFile2", command = OpenFile2,width=10).grid(column = 3,row=0) Label(master1, text=G,width=60).grid(row=0,column=2) all_data = pd.DataFrame() for f in glob.glob(G + "\*.xlsx"): print("\n", P,"\n", G) #check df = pd.read_excel(f) all_data = all_data.append(df,ignore_index=True) print (all_data) #test print writer = ExcelWriter('Pandas-Example.xlsx') ll_data.to_excel(writer,'Sheet1',index=False) writer.save() master1.mainloop() RE: all_data.append not work it should be - buran - Nov-29-2017 as is now, your code cannot run, because the indentation is broken. please, fix the indentation RE: all_data.append not work it should be - issac_n - Nov-29-2017 (Nov-29-2017, 11:17 AM)buran Wrote: as is now, your code cannot run, because the indentation is broken. please, fix the indentationwhat do u mean indentation here? ![]() RE: all_data.append not work it should be - buran - Nov-29-2017 please, read https://python-forum.io/Thread-Basic-Indentation RE: all_data.append not work it should be - Larz60+ - Nov-29-2017 see: https://www.python.org/dev/peps/pep-0008/#indentation |