Pandas row in printing whole structure instead of value.

0 votes

I am trying to interate over each row in Pandas:

import pandas as pd

df = pd.read_csv(“/home/user/data1”)

for row in df.iterrows():
    print (row)

I want to print only the value of the row but it is printing the whole structure like this

(1, Email    abc@gmail.com

Name: 229, dtype: object)
Mar 28 in Python by Shri
11 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Try this code, it should print only the value:

import pandas as pd

df = pd.read_csv(“/home/user/data1”)

for index, row in df.iterrows():
    print (row[‘Email’])
answered Mar 28 by Siri

Related Questions In Python

0 votes
1 answer

Pandas iloc printing whole row instead of cell value.

The syntax you are using is wrong. ...READ MORE

answered Apr 8 in Python by Hari
14 views
0 votes
1 answer

How can I find out the index of an element from row and column in Python?

You probably want to use np.ravel_multi_index: [code] import numpy ...READ MORE

answered Apr 16, 2018 in Python by charlie_brown
• 7,710 points
38 views
0 votes
1 answer

How can I reformat value_counts() analysis in Pandas for large number of columns?

If I were you, I'd do it ...READ MORE

answered Apr 17, 2018 in Python by anonymous
1,523 views
0 votes
1 answer

When to use %r instead of %s in Python? [duplicate]

The %s specifier converts the object using ...READ MORE

answered Aug 2, 2018 in Python by bug_seeker
• 14,970 points
40 views
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
20 views
+4 votes
6 answers
0 votes
1 answer

How to find the value of a row in a csv file in python?

If you want to find the value ...READ MORE

answered 2 days ago in Python by Sanam
8 views
0 votes
2 answers

In List of Dicts, find min() value of a common Dict field

lst = [{'price': 99, 'barcode': '2342355'}, {'price': ...READ MORE

answered Aug 31, 2018 in Python by Omkar
• 65,850 points
53 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.