Typing
Create sample CSV
dtype_sample.csv
Name,Experience,Age,Department,DepartmentID,CreatedDatetime,CreatedDatetimeTZ,Remote,OnBoard,Intern
John Doe,10,35,Engineering,001,2023-04-05T14:30,2023-04-05T14:30+08:00,true,V,0
Jane Smith,,29,Marketing,002,2023-02-28T08:15,2023-02-28T08:15+08:00,false,X,0
Emily Davis,2,27,Product,003,2023-03-15T12:45,2023-03-15T12:45+08:00,True,V,0
Mark Evans,5,30,Sales,004,2023-01-13T09:00,2023-01-13T09:00+08:00,FALSE,V,1
Deal with CSV file
Try to read CSV
Define dtype
np.where()
pd.to_datetime()
Datetime format
2023-04-05T14:30
2023-04-05T14:30+08:00
2023-04-05 14:30:00
2023/04/05 14:30:00
Try reading Excel
-
Create an Excel file with datetime columns
-
Read with pandas dtype
dtype = {
"CreatedDatetime": "datetime64[ns]",
}