I have data in the format:
0 20:30
1 17:05
2 17:28
3 14:12
4 19:58
.. ...
176 15:57
177 19:02
178 17:52
179 19:39
And it’s Dtype is Str type. How can I convert this str type (hour, minute) data into int type and use only the time part separately?
How can I convert this str type (hour, minute) data into int type and use only the time part separately?
>Solution :
def str_to_int_list(mylist):
newlist = []
for value in mylist:
hr, min_ = value.split(":")
newlist.append(int(hr)*60+int(min_))
return newlist