There are plenty of similar questions. Here are two:
Python Error: AttributeError: 'NoneType' object has no attribute 'to_excel'
AttributeError: