I created a dictionary of pandas dataframe:
d[k] = pd.DataFrame(data=data[i])
So I assume that d[k]
is a correct pandas dataframe.
Then
for k in d.keys():
d[k].to_excel (file_name)
Then I have the error:
TypeError: got invalid input value of type <class 'xml.etree.ElementTree.Element'>, expected string or Element
I am using Python 3.7, pandas 0.25.3.
Update: if I replace to_excel
by to_csv
, the code runs perfectly.