Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (19.9k points)

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!

1 Answer

0 votes
by (25.1k points)

You are getting this error 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 key as a string with value Email and value as a list of strings that represent email addresses. For example.:

email_dataframe = pd.DataFrame({ 'Email': ['[email protected]'] })

print(email_dataframe)

To learn more about different ways of using pandas, you can watch this video:

Browse Categories

...