Pandas DataFrame to CSV: Unexpected Formatting of Date Columns in v1.4.0
I'm working on a personal project and I'm working with an scenario when trying to export a Pandas DataFrame to a CSV file using `to_csv()`. Specifically, I'm dealing with a DataFrame that has a datetime column, and when I attempt to write it to a CSV, the formatting of the date is not what I expect. The DataFrame looks like this: ```python import pandas as pd data = { 'id': [1, 2, 3], 'date': [pd.Timestamp('2023-01-01'), pd.Timestamp('2023-01-02'), pd.Timestamp('2023-01-03')], 'value': [10, 20, 30] } df = pd.DataFrame(data) ``` When I run the following command to export the DataFrame: ```python df.to_csv('output.csv', index=False) ``` I expected the `date` column to be formatted as `YYYY-MM-DD`, but the resulting CSV shows the dates in a different format like `2023-01-01 00:00:00`. I've tried specifying the date format directly in the `to_csv` method using the `date_format` parameter, like this: ```python df.to_csv('output.csv', index=False, date_format='%Y-%m-%d') ``` However, I still see the same unwanted formatting in the output. This is particularly troublesome as I need the dates to be in a clean format for further processing in other tools that rely on CSV import. I am using Pandas version 1.4.0. Is there a way to ensure that the dates are exported in the desired format, or is there a workaround for this scenario? Any suggestions would be greatly appreciated! I'm working on a API that needs to handle this. Any ideas what could be causing this?