My timeseries dates are being jumbled (day/month) when I assign them as a datetimeindex. Sees odd that parser could get it so wrong, but have tried declaring format and using Dayfirst but nothing working.
#input_data = pd.read_csv(url)
input_data = pd.read_csv(url,usecols=['Dates','TYAFWD Comdty'],skiprows=None, parse_dates=True, nrows=1500)
# Set Date as Index, clean dataframe
input_data = input_data.set_index('Dates')
df = pd.DataFrame(input_data).dropna()
print(df.columns)
# Create new Date index
data_time = pd.to_datetime(df.index)
datetime_index = pd.DatetimeIndex(data_time.values) 
df = df.set_index(datetime_index)
df.index = pd.to_datetime(df.index, infer_datetime_format='%Y/%m/%d' )
df['year'] = pd.DatetimeIndex(df.index).year
df['month'] = pd.DatetimeIndex(df.index).month
df['week'] = pd.DatetimeIndex(df.index).weekofyear
print(df.head(30))
Can see from the output that it is all mixed up. I would expect all the entries in the output to be in May, the 5th month, but it is flipping the dates once <12
Here is my raw data: https://raw.githubusercontent.com/esheehan1/projects/master/BB_FUT_DATA.csv
Index(['TYAFWD Comdty'], dtype='object')
            TYAFWD Comdty  year  month  week
2020-05-26          0.508  2020      5    22
2020-05-25          0.494  2020      5    22
2020-05-22          0.494  2020      5    21
2020-05-21          0.508  2020      5    21
2020-05-20          0.512  2020      5    21
2020-05-19          0.512  2020      5    21
2020-05-18          0.552  2020      5    21
2020-05-15          0.483  2020      5    20
2020-05-14          0.474  2020      5    20
2020-05-13          0.494  2020      5    20
2020-12-05          0.510  2020     12    49
2020-11-05          0.548  2020     11    45
2020-08-05          0.527  2020      8    32
2020-07-05          0.494  2020      7    27
2020-06-05          0.568  2020      6    23
2020-05-05          0.541  2020      5    19