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, 2019 in Python by Shri

edited Jun 25, 2020 by MD 55,692 views

3 answers to this question.

0 votes

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

df1=pd.DataFrame(columns=[‘Email’])


This should work.

To know more, It's recommended to join our Python Training in Chennai today.

answered Mar 28, 2019 by Tina

edited Oct 7, 2021 by Sarfaraz
Thank you so much. It helped me instantly.
0 votes

Try:

df1=pd.DataFrame(columns=['Email'])
answered May 20, 2019 by anonymous
Same as above answer!
0 votes
It is not working because your code is not correct please try to this type of code I think so it's working

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

I hope it is working because I face this type of problem.

Try this.
answered May 13, 2020 by anonymous

edited May 13, 2020 by Gitika

Related Questions In Python

0 votes
0 answers
+1 vote
0 answers

TypeError: only integer scalar arrays can be converted to a scalar index

import cv2 import numpy as np import matplotlib.pyplot as ...READ MORE

Dec 18, 2019 in Python by sandeep
• 130 points
7,469 views
0 votes
1 answer

Error:Expected view to be called with a URL keyword argument named “pk”

Hello @kartik, View functions are called with the ...READ MORE

answered Jul 2, 2020 in Python by Niroj
• 82,840 points
8,934 views
+1 vote
1 answer

Can anyone help me with this error: TypeError: list indices must be integers or slices, not str

Hi, @Varshap  It’s a TypeError, which tells us ...READ MORE

answered Nov 5, 2020 in Python by anonymous
• 65,770 points
2,485 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,639 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,410 views
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
1,022 views
0 votes
1 answer

How to zip with a list output in Python instead of a tuple output?

Good question - Considering that you are ...READ MORE

answered Feb 7, 2019 in Python by Nymeria
• 3,560 points
1,952 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP