42324/python-pandas-typeerror-tuple-indices-must-integers-slices
Hi. Please help me solve this error. I am trying to print row values
import pandas as pd df = pd.read_csv(“/home/user/data1”) for row in df.iterrows(): print (row['Email'])
df.iterrows() returns a tuple with index and the row value. So, you will have handle both the index and the value. Try this:
import pandas as pd df = pd.read_csv(“/home/user/data1”) for index, row in df.iterrows(): print (row['Email'])
I get the following error when I try row[1]['Email']
TypeError: string indices must be integers, not str
Traceback (most recent call last): File "main.py", line ...READ MORE
Hi@akhtar, As we know that the index of ...READ MORE
Im a begginer and im trying to ...READ MORE
Hi, @Varshap It’s a TypeError, which tells us ...READ MORE
You can also use the random library's ...READ MORE
Syntax : list. count(value) Code: colors = ['red', 'green', ...READ MORE
can you give an example using a ...READ MORE
You can simply the built-in function in ...READ MORE
The error says the list is not ...READ MORE
Hi. Good question! Well, just like what ...READ MORE
OR
Already have an account? Sign in.