Datetime¶
to_datetime¶
From pandas 2.0, cannot use dayfirst separatedly.
# dayfirst applies to all formats (previously not yyyy-mm-dd)
to_datetime('2023-02-01', dayfirst=True)
>>> 2023-01-02
# dayfirst does not apply to yyyy-mm-dd format when use mixed (not compatable with old versions)
to_datetime('2023-02-01', dayfirst=True, format='mixed')
>>> 2023-02-01
read_csv¶
int column will be persed as int64, use dtype to set the type to int32.