I'm parsing weekly time series data from a source that shows dates using a year and week number. However, when trying to use Python's datetime.strptime
function to turn these into YYYY-MM-DD dates, two different week numbers sometimes evaluate to the same date, when I know that they should not. The weekly data is for the week ending on a Friday. For example:
datetime.strptime("1998-5-53", "%Y-%w-%U")
Out[43]: datetime.datetime(1999, 1, 8, 0, 0)
datetime.strptime("1999-5-01", "%Y-%w-%U")
Out[44]: datetime.datetime(1999, 1, 8, 0, 0)
The underlying data from the European Central Bank; an example series is here.