python 时间戳转时间 timestamp to time


pandas从postgreSQL数据库读取时间戳(timestamp)类型,转成python的时间(time)类型

使用datetime模块的datetime类的time方法

import datetime


print(type(df_order['time_start']),'\t',df_order['time_start'])
order_time_start = datetime.datetime.time(df_order['time_start'])
print(type(order_time_start),'\t',order_time_start)


# 运行结果 #
#        2016-11-01 18:21:27
#           18:21:27
# 运行结果 #