I'm using this repository:
https://github.com/fivethirtyeight/data/blob/master/avengers/avengers.csv
For an exercise in DataQuest, I have to count the number of 'Years since joining' is correct by subtracting 2015 (reference year) from column 'Year'.
I'm trying to use a for and if loop to do this simple task but I am having a hard time figuring out. How do I incorporate the 'for row' into the loop?
def Years_joined():
joined_accuracy_count = 0
for row in avengers['Years since joining']:
if (2015 - avengers['Year']) == avengers['Years since joining']:
joined_accuracy_count += 1
return joined_accuracy_count
Aucun commentaire:
Enregistrer un commentaire