pandas中时间处理
def titoday_1():
titoday = datetime.datetime.today()
titoday = titoday.strftime('%Y-%m-%d %H:%M:%S')
print(titoday)
titoday1 = time.strptime(str(titoday), '%Y-%m-%d %H:%M:%S')
titoday1= time.mktime(titoday1)
print(titoday1)
#print('c2,c2_time',c2,c2_time)
return titoday,titoday1
p_in'秒' = titoday_1()1- p_in'发生时间'.apply(lambda x: time.mktime(time.strptime(x, '%Y-%m-%d %H:%M:%S')))
m = datetime.datetime.today().month
d = datetime.datetime.today().day
p_warn'发生时间'=pd.to_datetime(p_warn'发生时间')
p_warn'year' = p_warn'发生时间'.dt.year
p_warn'month' = p_warn'发生时间'.dt.month
p_warn'day' = p_warn'发生时间'.dt.day
p_warn'hour' = p_warn'发生时间'.dt.hour
p_warn'minute' = p_warn'发生时间'.dt.minute
p_warn'查询时间_对打小区' = p_warn'查询时间_故障小区'+pd.DateOffset(minutes=30)
p_warn'前一天_查询时间_故障小区'=p_warn'查询时间_故障小区'-pd.DateOffset(days=1)
p_warn'前一天_查询时间_对打小区' = p_warn'查询时间_对打小区' - pd.DateOffset(days=1)