I'm having a hard time finding a way to sum a dataframe column and then compare the sum to make sure it's greater than zero. I'm trying to do this with the index location because my dataframe has duplicate header names.
My block:
for i, each in enumerate(headers):
if df.iloc[:, i].sum() > 0:
header_mod_list.append(i)
print(header_mod_list)
When I run this, I get an error:
TypeError: unsupported operand type(s) for +: 'float' and 'str'
Also, some of my columns do contains string values and others are float values since these are budget files.
Any thoughts? Thank you!