the date and time stamp pandas string conversion

df:

image

Date turn timestamp

dtime = pd.to_datetime(df['故障开始'])

v = (dtime.values - np.datetime64('1970-01-01T08:00:00Z')) / np.timedelta64(1, 'ms')

df['start_time'] = v

image

Transfer date time stamp

df['故障开始'] = pd.to_datetime(df['start_time'],unit='ms',origin=pd.Timestamp('1970-01-01 08:00:00'))

image

Guess you like

Origin www.cnblogs.com/haoyiyang/p/11309771.html