The dataframe is on my drive:
url = 'https://drive.google.com/file/d/12R6nMvN81GJHSBEElP8NiXXkwtuv04wf/view?usp=sharing'
url = 'https://drive.google.com/uc?id=' + url.split('/')[-2]
df = pd.read_csv(url)
sym time online_price
0 1000FLOKIUSDT 00:04.9 0.02567
1 1000FLOKIUSDT 00:31.7 0.02527
2 1000FLOKIUSDT 59:23.4 0.03638
3 1000FLOKIUSDT 59:23.4 0.03554
4 1000FLOKIUSDT 58:59.2 0.03552
... ... ... ...
3640 ZRXUSDT 00:58.8 0.30240
3641 ZRXUSDT 00:19.7 0.42730
3642 ZRXUSDT 00:19.7 0.42920
3643 ZRXUSDT 00:19.7 0.43130
3644 ZRXUSDT 00:19.7 0.42810
I want to convert column time to datetime. I have tried several ways but all of them leads to the error that is the title of the post.
My desired format for date is: format='%Y-%m-%d %H:%M:%S'
These are the ways that I have tried:
df['time'] = pd.to_datetime(df.time)
df['time'] = pd.to_datetime(df.time, format='%Y-%m-%d %H:%M:%S')
df['time'] = pd.to_datetime(df.time, infer_datetime_format=True)
>Solution :
The time column looks like this:
00:04.9
00:31.7
59:23.4
Those aren’t timestamps. They may be timer values giving minutes:seconds, but in that case they’re durations. Why are you trying to interpret them as times of day? What time does 59:23.4 represent?