Are you sure you wrote the full file name with the extension? That error seems to occur if you don't include the ".xlsx". If you want to avoid being hassled by the file extension, you could change the last few lines to read as follows:
filename = QFileDialog.getSaveFileName()
if not filename.endswith('.xlsx'):
filename += '.xlsx'
df.to_excel(filename)
That will check if the name specified ends with ".xlsx" and will add it for you if it is missing.