Home > other >  Python open TAB delimited excel file, please help me have a look.
Python open TAB delimited excel file, please help me have a look.

Time:10-05

I wrote a python code, used to open the excel file, and then after the save, but the attachment of the excel file cannot be opened, please help me to look at what's going on? Thank you very much!
(question how to upload attachment? )

 
The import pandas as pd
The import glob
The import OS

Input_path="D:/pythonProject/venv '
Output_file="D:/pythonProject/venv/result/test111 XLSX '

Def W_Excel (input_path output_file) :
Dataframe=[]

All_workbooks=glob. Glob (OS) path) join (input_path, '*. XLS *))
Print (all_workbooks)
For workbook in all_workbooks:
All_worksheets=pd. Read_excel (workbook, sheet_name=None, index_col=None)
For worksheet_name, data in all_worksheets. The items () :
Dataframe. Append (data. Loc [(data [' dates']=='2019/6/12') & amp; (data [' mileage]==2566)])
All_data_concatenated=pd. Concat (dataframe, axis=0, ignore_index=True)
Write=pd. ExcelWriter (output_file)
All_data_concatenated. To_excel (write, sheet_name='new' index=False)
Write. The save ()

If __name__=="__main__" :
W_Excel (input_path output_file)
  • Related