Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

dateutil.parser._parser.ParserError: hour must be in 0..23:

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'

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading