'Pandas changes date format while reading csv file altough format in the file does not change

I have a problem that I don't understand with reading a csv file using pandas. Pandas suddenly changes the format of the date altough the format in the file is exactly the same. Here you can see the screenshot of the file, once opened with Excel, once with Windows-Editor, and once after Pandas has read it in Sypder.

enter image description here

You can see that the date format remains the same in Excel and the CSV file but when Pandas reads it, it suddently changes it by switching the order of months and days.

Here is the code I use:

import pandas as pd

pathOfTheInputData = "C:/Users/User1/Desktop/Test_Read_Date.csv"

df = pd.read_csv(pathOfTheInputData, sep=';', header=0, low_memory=False, infer_datetime_format=True, parse_dates={'datetime':[0]}, index_col=['datetime'])

And here you can have a look at the data: Test_Data

Any idea why this is happening? I also tried it by setting infer_datetime_format=False but this leads to the same result.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source