所以,我有一个具有两种不同日期格式的日期列,例如:
1/2/2011
13-01-2011
我有代码:
superstore['Order Month'] = superstore['Order Date'].apply(lambda x: datetime.datetime.strptime(x,"%d/%m/%Y").strftime('%m/%Y'))
Google colab 回归
ValueError: time data '13-01-2011' does not match format '%d/%m/%Y'
如何解决这个问题?