pandas中时间处理

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)

相关推荐
虎头金猫4 天前
4K 视频总卡在公网带宽?用 N1 + OpenList 把网盘播放链路重新理顺
运维·服务器·网络·python·容器·beautifulsoup·pandas
Xiu Yan4 天前
Python 数据分析:Pandas DataFrame 零基础入门教程
python·jupyter·pycharm·numpy·pandas
2601_966949655 天前
为什么量化回测中 for 循环比 DataFrame 慢三个数量级?从向量化原理讲起
开发语言·python·pandas·股票数据·quantdash
Xiu Yan5 天前
Python 数据分析:Pandas Series 零基础入门教程
python·jupyter·pycharm·numpy·pandas
gCode Teacher 格码致知6 天前
Pandas教学-6:coerce详解
python·pandas
benchmark_cc6 天前
策略临时需要一批股票的最新价格,先查行情还是先建股票池?——从量化策略执行逻辑看数据获取顺序
python·数据分析·pandas·量化交易·股票数据·quantdash
2601_966949657 天前
只拿到股票代码还不够:量化程序到底还需要哪些标的信息?——从数据建模开始理解股票元数据
开发语言·python·数据分析·pandas·量化交易·股票数据·quantdash
szephyr7 天前
用 Python 写自动化脚本:定时任务、文件批处理、自动出报表
python·自动化·pandas·脚本·定时任务
智购科技无人售货机工厂11 天前
2026自动售货机AI智能体架构:从47个小模型到33.7亿Token的工程实践~YH
android·人工智能·驱动开发·单片机·pandas
小葱炖豆腐12 天前
python绘制excel折线图
python·excel·numpy·pandas·matplotlib