Python Pandas: ValueError: DataFrame constructor not properly called!

2.9K    Asked by DaniloGuidi in Python , Asked on Apr 18, 2021

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

df1=pd.DataFrame('Email')

But I am getting this error:

ValueError: DataFrame constructor not properly called!

Answered by Danilo Guidi

You are getting this error “Python Pandas: ValueError: DataFrame constructor not properly called” because you are calling the DataFrame constructor with invalid arguments. To create a data frame you need to pass data in a valid format. In your case, you need to pass a dictionary with a key as a string with the value Email and value as a list of strings that represent email addresses. For example.:

email_dataframe = pd.DataFrame({ 'Email': ['abc@xyz.com'] })
print(email_dataframe)

Your Answer

Answer (1)

2 Years

Interviews

Parent Categories