I was wondering if someone can take a look at my formatting code and can explain to me why some of my data looks like 2009/09/11 and 2009-09-11 intermittently. Like one row its 2009/09/11 and another its formatted as 2009-08-11. I am trying to set it up for a ds field for neuroProphet but for some reason it isn't wanting to format it to a datetime object. The original dates look like this 20090911.
df['year'] = df['ds'].apply(lambda x:str(x)[:-4])
df['month'] = df['ds'].apply(lambda x:str(x)[-6:-4])
df['day'] = df['ds'].apply(lambda x: str(x)[-2:])
df['ds'] = df['year'] + '/' + df['month']+ '/' + df['day']
df['ds'] = pd.to_datetime(df['ds'],format='%Y/%m/%d')
ValueError: time data '2009/09/18' does not match format '%y/%m/%d' (match)
I tried to re-run the cells but they keep on formatting to either 2009/09/11 or 2009/09/11 when I export it to a csv(to look at it more closely because I am having a mismatch error). I am wondering if excel automatically formats it but I am not sure. As an added note I do switch
df['ds'] = df['year'] + '/' + df['month']+ '/' + df['day']
to
df['ds'] = df['year'] + '-' + df['month']+ '-' + df['day']
to see if it fixes it. I am wondering if its google collabs fault but I am not sure what is entirely going on.