Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert Column To Time
#2
It would be easier if you post also your code. You can use apply function to convert your column to datetime, so it would look something like this:
from datetime import datetime
df['timestamp'] = df['timestamp'].apply(lambda x: datetime.strptime(x, '%Y-%m-%d %H:%M:%S'))
Reply


Messages In This Thread
Convert Column To Time - by Talch - Aug-16-2018, 11:46 AM
RE: Convert Column To Time - by mlieqo - Aug-16-2018, 03:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question Convert UTC now() to local time to compare to a strptime() Calab 2 260 Apr-29-2024, 07:24 PM
Last Post: deanhystad
  Cannot convert the series to <class 'int'> when trying to create new dataframe column Mark17 3 8,614 Jan-20-2022, 05:15 PM
Last Post: deanhystad
  Convert looping home security to a one time scan of switches and sensors duckredbeard 0 1,783 Dec-08-2020, 04:31 AM
Last Post: duckredbeard
  Convert to UTC without changing time pythonlearner1 1 2,149 Nov-05-2020, 09:54 PM
Last Post: pythonlearner1
  Convert quarterly time series to monthly time series donnertrud 1 5,224 May-22-2020, 10:16 AM
Last Post: pyzyx3qwerty
  Convert weekly sequences to date and time. SinPy 0 1,477 Nov-23-2019, 05:20 PM
Last Post: SinPy
  Parse Binary Data File and convert Epoch Time drdevereaux 1 3,224 May-16-2019, 01:56 AM
Last Post: Larz60+
  Convert from datetime to time.struct_time object chris0147 0 4,410 Mar-11-2018, 12:01 AM
Last Post: chris0147
  Time Difference in Epoch Microseconds then convert to human readable firesh 4 11,678 Feb-27-2018, 09:08 AM
Last Post: firesh
  Convert from time.struct_time to a string chris0147 2 7,784 Feb-22-2018, 04:53 PM
Last Post: chris0147

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020