I am trying to do an analysis for the first time in Python. I cannot define my datetime column as a datetime object in Python. I am using Jupyter Notebook for python codes. I have 1 minute data for usdtry exchange rate for 2018. I already calculated the return series so there is only one variable/column. My date/time appears in the same column (as in the attached image). I have 335495 rows so I have to write a code that will work for all rows. My date doesn't include any string variable thus existing answers don'T help in my case. I already tried previously shared codes in other questions but none of them work such as:
usdtry_2018['DATE'] = pd.to_datetime(usdtry_2018['DATE']), infer_datetime_format=True)
I read my csv file in Jupyter Notebook using python codes:
usdtry_2018 = pd.read_csv("C:/Users/yener/Dropbox/PC/Desktop/usdtry_2018.csv")
parse_dates=['DATE']
index_col=['DATE']
usdtry_2018.head()
usdtry_2018.dtypes
---- DATE object
rtrn float64
dtype: object
usdtry_2018.index
----RangeIndex(start=0, stop=335494, step=1)
usdtry_2018.reset_index()
usdtry_2018.plot(y="rtrn",
title="Return")
plt.show()
But it seems that my date column cannot be defined as a datetime object since it doesn't appear on the x axis when I plot it. Can somenone share me the codes to read my csv and define my datetime column as a datetime object for 1 minute data. After that I will need to convert it to 5 minute data. Then which code will make it as a dataframe for the true datetime? Can I use the name of my series (rtrn) to apply econometric models commands or do I need to give another name for my variable to be a list, vector, object or smth else. If anyone can help for the codes, I will appreciate it.