Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- df = pd.DataFrame({
- 'text': [
- ' 00:00:01 ',
- '2018.06.29 00:00:01',
- 'Hello 01:00:00'
- ],
- })
- print(df)
- df['time'] = df['text'].apply(lambda x: x.strip()[-8:])
- print(df)
- df['time'] = pd.to_datetime(df['time'], format='%H:%M:%S')
- print(df)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement