Home > Blockchain >  DataFrame Export to Excel File is not updated in Pandas
DataFrame Export to Excel File is not updated in Pandas

Time:01-05

I imported the file and extracted the rows "Batch 12" from the sheet

df = pd.read_excel (r'F:\Tutorials\PIAIC\AI Batch 12 Peshawar\Quarter 2\AIC Result.xlsx')
df[df['Batch']==('Batch 12')]

Now I want to export this Updated DataFrame of "Batch 12" to an excel file but the excel file is not being updated after export.

df.to_excel(r'F:\\Tutorials\\PIAIC\\AI Batch 12 Peshawar\\Quarter 2\\New.xlsx',index=False)

CodePudding user response:

You have to assign a value to the output of your code, like this:

df = df[df['Batch']=='Batch 12']
  •  Tags:  
  • Related