Issue in converting Timetstamp format

Giki :

In my data frame I have a column which contains timestamps. Now these timestamps are in the format(yyyy-mm-dd hh:mm:ss) and I want to change them to (dd--mm-yyyy hh:mm:ss). I have tried to do so but only the first row is changing properly and the rest of the rows are converting to epoch time i think.

Snapshot of Dataframe

Click here for Snapshot of Dataframe

what I tried

Click here to see what I tried

the other way I tried

Click to see the other way I tried

As you can see only the first row is changing whereas the other rows are not. Please help guys!!!

EnriqueBet :

I believe is because of the data type of your column in pandas. If you want to follow your previous attempts, you could just create a new column and fill the data as a string like this:

df_sch["UTC Formatted"] = [datetime.datetime.strftime(entity, "%d-%m-%Y %H:%M%S") for entity in df_sch["UTC"]]

In this sense the data will be stored as string! Hope this helps!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=345953&siteId=1