Python pandas: TypeError: Index(...) must be called with a collection of some kind, 'Email' was passed

0 votes

I am trying to create a Pandas Dataframe and the code I am using is as follows:

df1=pd.DataFrame(columns='Email')

When I run this line, I get the below error:

TypeError: Index(...) must be called with a collection of some kind, 'Email' was passed

Please help

Mar 28 in Python by Shri
4,460 views

2 answers to this question.

0 votes

The syntax is not right. The right syntax is as follows:

df1=pd.DataFrame(columns=[‘Email’])
answered Mar 28 by Tina
0 votes

Try:

df1=pd.DataFrame(columns=['Email'])
answered May 19 by anonymous
Same as above answer!

Related Questions In Python

0 votes
2 answers

Finding the index of a character in python string

You can use word.find('o') as well to ...READ MORE

answered Jun 1, 2018 in Python by george
• 200 points
123 views
0 votes
1 answer

How do I generate some random numbers with a distribution using Python?

scipy.stats.rv_discrete is what you ned IMHO. You can supply ...READ MORE

answered Oct 31, 2018 in Python by Anirudh
• 2,070 points

edited Dec 14, 2018 by Anirudh 142 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 345 views
+4 votes
6 answers
0 votes
3 answers
0 votes
1 answer

Using Python what kind of applications can be built?

http://en.wikipedia.org/wiki/List_of_Python_software  follow the link and You will see ...READ MORE

answered Nov 14, 2018 in Python by Theodor
• 740 points
30 views