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
22 views

1 answer to this question.

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
121 views
0 votes
1 answer

Add header row in pandas dataframe while printing

Refer to this code: import pandas as pd col_name=['Name', ...READ MORE

answered Jul 5 in Python by Suri
159 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,720 points
73 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
2,041 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 216 views
+4 votes
6 answers
0 votes
1 answer
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
• 67,380 points
88 views