I’m working on a Python program that imports a CSV file into an SQL table, I need to maintain the integrity of the data and ensure it adheres to the specified schema without alterations.
Some of the date columns values are set to NaT, but when I execute the to_datetime function It transforms them into the default 1970-01-01.
Whereas I need it to stay at NaT because I want to keep the value as it is.
data[column]= pd.to_datetime(data[column],errors='coerce')
Example of data :
COLUMN_A
0 NaT
1 NaT
2 NaT
The output in the SQL table is :
COLUMN_A
0 1970-01-01
1 1970-01-01
2 1970-01-01
Is there a way to expose this column type as DATE while maintaining the integrity of my data ?