I'm trying to create new columns in a dateframe that will indicate blank or not blank for the rest of the columns. I think this should be fairly simple, but I'm having trouble getting the code quite right...
for column, row in df.iterrows():
if(pd.isnull(row[column])):
df[column + 'Blank or Not'] = "blank"
else:
df[column + 'Blank or Not'] = "not blank"
This is the error:
TypeError: unsupported operand type(s) for +: 'int' and 'str'
When I changed it to below:
for column, row in df.iterrows():
if(pd.isnull(row[column])):
df[str(column) + 'Blank or Not'] = "blank"
else:
df[str(column) + 'Blank or Not'] = "not blank"
This is the error:
IndexError: index out of bounds