Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- text = '''0 00:05:00
- 1 00:20:00
- 2 00:35:00
- 3 05:23:00
- 4 05:38:00
- 5 05:53:00
- 6 06:08:00
- 7 06:18:00
- 8 06:28:00
- 9 06:38:00
- 10 06:48:00
- 11 06:54:00
- 12 07:00:00
- 13 07:06:00
- 14 07:11:00
- 15 07:16:00
- 16 07:21:00
- 17 07:26:00'''
- data = [line.split(' ') for line in text.splitlines()]
- print('type:', df['time'].dtype)
- df = pd.DataFrame(data, columns=['index', 'time'])
- df['timedelta'] = pd.to_timedelta(df['time']).dt.seconds
- print(df['timedelta'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement