Pandas append data to Excel

Methods: Dataframe increased by one line, and then save it as excel file.

pd.DataFrame = DF (pd.read_excel ( ' test.xlsx ' )) reads the original data # 
df_rows = df.shape [0] # Get the number of rows 
# increase a data 
df.loc [df_rows] = [a1, b2, C3, D4] # original data format with 
df.to_excel ( ' test.xlsx ' , SHEET_NAME = ' Sheet1 ' , index = False, header = True)

 

Guess you like

Origin www.cnblogs.com/sxinfo/p/11721715.html