I have the dataset called gd, taken from an xls, an example:
DATA_CRIA FROTA
1971 2
1972 19
1973 19
This dataset has several entries with the pattern listed above, I would like to create a dictionary with the values of each years added to previous ones, for example:
{1971:2, 1972:21, 1973:40}
For this I did this:
dic_ano = {}
for ano in anos:
dic_ano.update({ano:0})
for i in range(len(gd)):
for ano in anos:
if gd.iloc[i]['DATA_CRIA'] == ano:
dic_ano[ano] = dic_ano[ano]+1
But the values are not coming out with the right count, what should I do?