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
643 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
3,852 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
7,607 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, 2020 in Python by Niroj
• 82,840 points
6,769 views
0 votes
2 answers

Deleting DataFrame row in Pandas based on column value

Pandas provide data analysts a way to ...READ MORE

answered Jan 4, 2021 in Python by Nikita
2,439 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,434 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,071 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
19,219 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,220 points
7,890 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