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