I have the following function that I have done that is this:
def funcao(elemento):
x = []
for i in grafico:
timestring = i["CrimeTime"]
x.append(timestring)
x= sorted(x)
y= Counter(x).values()
return x,y
And what it gives me is:
(['16:40:00', '16:45:00', '17:30:00', '18:30:00', '18:38:00', '20:00:00', '21:30:00', '21:30:00', '21:51:00'], [1, 1, 2, 1, 1, 1, 1, 1])
Being what you should give me is:
Código :
(['16:40:00', '16:45:00', '17:30:00', '18:30:00', '18:30:00', '20:00:00', '21:30:00', '21:30:00', '21:51:00'], [1, 1, 1, 2 , 1,2, 1])
The goal is to get the ordered hours that give correct, and the number of times that each hour repeats, being that the values are well, they are not correctly positioned (it may have to do with the fact to get the values to the dictionary) but I'm not seeing how I get the correctly sorted values