Skip to content
Advertisement

Cleaning up data frame and date time

I am working with data frame. One of the columns contains date where the format of cell are mixed between date, time and string. The sample date frame is as follow:

JavaScript

I want to create a new column that contains the text of date column. The expected output is as follows:

enter image description here

How can I do that?

Advertisement

Answer

IIUC using to_datetime, the select the position return NaN, then ffill

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement