0
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 with previous, for example:
{1971:2, 1972:21, 1973:40}
That’s why 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 figures aren’t coming out with the right count, what should I do?
Is that what you want? https://repl.it/@marcelobonifazio/Rosybrownorchidmegabyte
– MarceloBoni
I was wrong in my explanation, I implied that the dataset was only these values, but I already arranged.
– user9080886
I have to convert the data to a dictionary, but the data is not in a dictionary.
– user9080886
You happen to be using Pandas?
– Woss
yes, but I haven’t been able to.
– user9080886