My CSV has one of the column has the following date format.
5/2/2010
12/2/2010
19-02-2010
26-02-2010
5/3/2010
12/3/2010
19-03-2010
26-03-2010
2/4/2010
9/4/2010
When I read csv file & print the data frame I am getting as expected as below.
file_path = r'Store_sales.csv'
date_series_data = pd.read_csv(file_path)
date_series_data.head()
output
05-02-2010
12-02-2010
19-02-2010
26-02-2010
05-03-2010
When I print the data type it's shows Object data type. So i am not able to set as index.
So I used pd.to_datetime(date_series_data)
convert object to datetime64[ns].
But the dateformat of first two element got changed as below
2010-05-02
2010-12-02
2010-02-19
2010-02-26
2010-03-05
Due to this my various calculation goes wrong. Is there effective to way to convert & get similar format?