From a CSV of various years, I am trying to total up values in another column from one particular year. For example, take arbitrary values
years | value |
---|---|
2000 | 5 |
2001 | 4 |
2000 | 3 |
2002 | 6 |
and so on
with a defined value total as total_value = 0
.
I have:
for year in years:
if year == 2000:
total_value += ???
where the returned value should be 8. I've tried using the .loc modifier to no avail. It's a simple question but I just can't get it right now!