open source – Python library to parse a wide range of possibly incomplete datestrings into the date ranges they represent


I’m looking for a library that helps me parse the date ranges represented by a wide variety of date strings.

For example, 2023Q1 should be parsed as daterange(start=date(2023,01,01),end=date(2023,04,01)) (end-exclusive), whereas 2023-02-03 should be daterange(start=date(2023,02,03),end=date(2023,02,04)) etc.

Previously, I was using pandas’ internal function parsing.parse_datetime_string_with_reso but using non-public APIs like this is a bad idea, I’d like something more stable.

To my surprise, I haven’t been able to find a library that does this job without requiring some hacks. Has anyone else encountered and maybe solved this issue?



Source link

Related Posts

About The Author

Add Comment