为什么使用 sort_values 对时间戳进行排序不起作用?
Why Sorting the timestamp using sort_values is not working?
我有一列时间戳转换为人类可读的形式。
我试图从纪元时间以及转换后对其进行排序。它给了我
Fri, 08 Feb 2019 17:24:16 IST
Mon, 11 Feb 2019 02:19:40 IST
Sat, 09 Feb 2019 00:22:43 IST
未排序。
我用过sort_values()
each_tracker_df = each_tracker_df.sort_values(["timestamp"],ascending=True)
为什么它不起作用??
因为所有时间都在 IST 中。将字符串 IST 替换为 NULL.
>>import datetime
>>times=['Fri, 10 Feb 2010 17:24:16','Fri, 11 Feb 2010 17:24:16','Fri, 11 Feb 2019 17:24:16']
>>change_format=[]
>> for time in times:
change_format.append(datetime.datetime.strptime(time, '%a, %d %b %Y %H:%M:%S'))
>>change_format.sort()
我有一列时间戳转换为人类可读的形式。 我试图从纪元时间以及转换后对其进行排序。它给了我
Fri, 08 Feb 2019 17:24:16 IST
Mon, 11 Feb 2019 02:19:40 IST
Sat, 09 Feb 2019 00:22:43 IST
未排序。
我用过sort_values()
each_tracker_df = each_tracker_df.sort_values(["timestamp"],ascending=True)
为什么它不起作用??
因为所有时间都在 IST 中。将字符串 IST 替换为 NULL.
>>import datetime
>>times=['Fri, 10 Feb 2010 17:24:16','Fri, 11 Feb 2010 17:24:16','Fri, 11 Feb 2019 17:24:16']
>>change_format=[]
>> for time in times:
change_format.append(datetime.datetime.strptime(time, '%a, %d %b %Y %H:%M:%S'))
>>change_format.sort()