So... once again I'm having trouble with datetime formats. This because IDK why amazon's database continously changes the date format and each time it's a trouble. Today Im asking for your help to convert this string to datetime object. I just can't find the right format.
"ene" it's like Jan but in spanish. Thing is that even though locale.getlocale() is set to spanish, it doesnt convert it (but it does convert the english date strings). I've also tried replacing "ene" to "Jan" and doesn't work either. I'm still getting the "time data '2 ene. 2020 9:54:46' does not match format '%d %b. %Y %H:%M:%S'" error.
data={'fecha/hora': {0: '2 ene. 2020 9:54:46',
1: '2 ene. 2020 10:18:51',
2: '2 ene. 2020 10:19:18',
3: '2 ene. 2020 11:58:04',
4: '2 ene. 2020 15:56:51'},
'Id. de liquidación': {0: 12493053261,
1: 12493053261,
2: 12493053261,
3: 12493053261,
4: 12493053261}}
df=pd.DataFrame(data)
df["fecha"]=prueba.apply(lambda x: datetime.datetime.strptime(x["fecha/hora"],"%d %b. %Y %H:%M:%S"),axis=1)
If you guys know any tutorial to help me out with this i'll be glad to see it. Honestly i'm following the documentation but i just can't figure out how to work with datetime objects efficiently. Also because each Database I reaceive has differents formats in different lenguages.
also, the original date format is with tz "gmt-8". I erased it but if theres a way to work with it would be even better.
data={'fecha/hora': {0: '2 ene. 2020 9:54:46 GMT-8',
1: '2 ene. 2020 10:18:51 GMT-8',
2: '2 ene. 2020 10:19:18 GMT-8',
3: '2 ene. 2020 11:58:04 GMT-8',
4: '2 ene. 2020 15:56:51 GMT-8'},
'Id. de liquidación': {0: 12493053261,
1: 12493053261,
2: 12493053261,
3: 12493053261,
4: 12493053261}}
df=pd.DataFrame(data)
thanks in advance!