You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Creating a corrupted file with open('a.xlsx', 'w') as f: pass
# Reading using pd.ExcelFile data = pd.ExcelFile('a.xlsx', engine='openpyxl')
# Deleting the file os.remove('a.xlsx')
Here, I create a .xlsx file which is not the correct way to make xlsx file but this will express my concern. Then I use pd.ExcelFile to read the xlsx file but it gives me zipfile.BadZipFile: File is not a zip file which is fine but later when I try to delete that file I get PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'a.xlsx'. This doesn't happen in pandas==1.2.1 and lower version. The current version i.e. pandas==1.2.4 has this bug.