[Python] How to change the datetime format in Pandas

Discussão em 'Python' iniciado por Stack, Abril 11, 2025.

  1. Stack

    Stack Membro Participativo

    My dataframe has a DOB column (example format 1/26/2016) which by default gets converted to Pandas dtype 'object'.

    Converting this to date format with df['DOB'] = pd.to_datetime(df['DOB']), the date gets converted to: 2016-01-26 and its dtype is datetime64[ns].

    Now I want to convert this date format to 01/26/2016 or any other general date format. How do I do it?

    (Whatever the method I try, it always shows the date in 2016-01-26 format.)

    Continue reading...

Compartilhe esta Página