Python Pandas: ValueError: DataFrame constructor not properly called!


I am trying to create a Python Pandas Dataframe using this code:.


But I am getting this error:

ValueError: DataFrame constructor not properly called!




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,:


which will solve the error.



The syntax represented above is incorrect. Below is the correct syntax that has to be used.



If you want to unleash your potential in this competitive field, please visit the Python course page for more information, where you can find the Python tutorials and Python frequently asked interview questions and answers as well.


This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.