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, 2019 in Python by Shri
99 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, 2019 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, 2019 in Python by Hari
1,346 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, 2019 in Python by Suri
5,352 views
0 votes
1 answer

How to find the value of a row in a csv file in python and print column and row of that value ?

Hello @Khanhh , Use panda to find the value of ...READ MORE

answered Oct 15 in Python by Niroj
• 78,520 points
198 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,780 points
402 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, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,564 views
0 votes
0 answers
+4 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,800 points
1,186 views
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 May 20, 2019 in Python by Sanam
1,233 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
• 69,030 points
3,197 views