I have a dictionary and I want to sort it according to its key. Although I dont have an error, my key value (date) is not sorted.
If anyone could help me, I will be happy. Thanks.
    d = defaultdict(list)
    for row in rows:
        date = row[0]
        speed = float(row[1])
        if date not in d:
            d[date] = [speed]
        elif date in d:
            speeds = d[date]
            speeds.append(speed)
            d[date] = speeds
        date = d.keys()
        date = sorted(d,key=lambda key:d[key])
        print date
"Print date" result:
['2015/01/01 10:04', '2015/01/01 08:40', '2015/01/01 10:14', '2015/01/01 09:56', '2015/01/01 09:54', '2015/01/01 10:08', '2015/01/01 10:06', '2015/01/01 10:10', '2015/01/01 10:16', '2015/01/01 09:52']
 
     
    