It seems a string representation isn't satisfying enough for the DataFrame constructor. This means that you are providing a string representation of a dict to DataFrame constructor, and not a dict itself. So this is the reason you get that error. Just simply adding the list() around the dictionary items,:
df=pd.DataFrame(list(test_dict.items()),columns=['col1','col2'])
which will solve the error.
The syntax represented above is incorrect. Below is the correct syntax that has to be used.
Df1=pd.DataFrame(columns=[‘Email’])
If you want to unleash your potential in this competitive field, please visit the Python Training Certification page for more information, where you can find the and Python Interview Questions FAQ's and answers as well.
For more updates on the latest courses stay tuned to HKR Trainings.