网络安全最新Pandas库分析-时间序列的处理_pandas q-dec(1),2024年最新被面试官问的网络安全-Framework难倒了

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化资料的朋友,可以点击这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

dtype=‘datetime64[ns]’, freq=‘M’)

“”"

period_rng = pd.period_range(‘2019/01/01’, freq=‘M’, periods=12)

print(f’month period_range():\n{period_rng}')

“”"

period_range():

PeriodIndex([‘2019-01’, ‘2019-02’, ‘2019-03’, ‘2019-04’, ‘2019-05’, ‘2019-06’,

‘2019-07’, ‘2019-08’, ‘2019-09’, ‘2019-10’, ‘2019-11’, ‘2019-12’],

dtype=‘period[M]’, freq=‘M’)

“”"

date_rng = pd.date_range(‘2019-01-01’, freq=‘W-SUN’, periods=12)

print(f’week date_range():\n{date_rng}')

“”"

week date_range():

DatetimeIndex([‘2019-01-06’, ‘2019-01-13’, ‘2019-01-20’, ‘2019-01-27’,

‘2019-02-03’, ‘2019-02-10’, ‘2019-02-17’, ‘2019-02-24’,

‘2019-03-03’, ‘2019-03-10’, ‘2019-03-17’, ‘2019-03-24’],

dtype=‘datetime64[ns]’, freq=‘W-SUN’)

“”"

period_rng=pd.period_range(‘2019-01-01’,freq=‘W-SUN’,periods=12)

print(f’week period_range():\n{period_rng}')

“”"

week period_range():

PeriodIndex([‘2018-12-31/2019-01-06’, ‘2019-01-07/2019-01-13’,

‘2019-01-14/2019-01-20’, ‘2019-01-21/2019-01-27’,

‘2019-01-28/2019-02-03’, ‘2019-02-04/2019-02-10’,

‘2019-02-11/2019-02-17’, ‘2019-02-18/2019-02-24’,

‘2019-02-25/2019-03-03’, ‘2019-03-04/2019-03-10’,

‘2019-03-11/2019-03-17’, ‘2019-03-18/2019-03-24’],

dtype=‘period[W-SUN]’, freq=‘W-SUN’)

“”"

date_rng = pd.date_range(‘2019-01-01 00:00:00’, freq=‘H’, periods=12)

print(f’hour date_range():\n{date_rng}')

“”"

hour date_range():

DatetimeIndex([‘2019-01-01 00:00:00’, ‘2019-01-01 01:00:00’,

‘2019-01-01 02:00:00’, ‘2019-01-01 03:00:00’,

‘2019-01-01 04:00:00’, ‘2019-01-01 05:00:00’,

‘2019-01-01 06:00:00’, ‘2019-01-01 07:00:00’,

‘2019-01-01 08:00:00’, ‘2019-01-01 09:00:00’,

‘2019-01-01 10:00:00’, ‘2019-01-01 11:00:00’],

dtype=‘datetime64[ns]’, freq=‘H’)

“”"

period_rng=pd.period_range(‘2019-01-01 00:00:00’,freq=‘H’,periods=12)

print(f’hour period_range():\n{period_rng}')

“”"

hour period_range():

PeriodIndex([‘2019-01-01 00:00’, ‘2019-01-01 01:00’, ‘2019-01-01 02:00’,

‘2019-01-01 03:00’, ‘2019-01-01 04:00’, ‘2019-01-01 05:00’,

‘2019-01-01 06:00’, ‘2019-01-01 07:00’, ‘2019-01-01 08:00’,

‘2019-01-01 09:00’, ‘2019-01-01 10:00’, ‘2019-01-01 11:00’],

dtype=‘period[H]’, freq=‘H’)

“”"

2、生成Timestamp对象及转换

创建一个Timestamp时间戳对象有pd.Timestamp()方法和pd.to_datetime()方法。如下所示:

ts=pd.Timestamp(2019,1,1)

print(f’pd.Timestamp()-1:{ts}')

#pd.Timestamp()-1:2019-01-01 00:00:00

ts=pd.Timestamp(dt(2019,1,1,hour=0,minute=1,second=1))

print(f’pd.Timestamp()-2:{ts}')

#pd.Timestamp()-2:2019-01-01 00:01:01

ts=pd.Timestamp(“2019-1-1 0:1:1”)

print(f’pd.Timestamp()-3:{ts}')

#pd.Timestamp()-3:2019-01-01 00:01:01

print(f’pd.Timestamp()-type:{type(ts)}')

#pd.Timestamp()-type:<class ‘pandas._libs.tslibs.timestamps.Timestamp’>

#dt=pd.to_datetime(2019,1,1) 不支持

dt=pd.to_datetime(dt(2019,1,1,hour=0,minute=1,second=1))

print(f’pd.to_datetime()-1:{dt}')

#pd.to_datetime()-1:2019-01-01 00:01:01

dt=pd.to_datetime(“2019-1-1 0:1:1”)

print(f’pd.to_datetime()-2:{dt}')

#pd.to_datetime()-2:2019-01-01 00:01:01

print(f’pd.to_datetime()-type:{type(dt)}')

#pd.to_datetime()-type:<class ‘pandas._libs.tslibs.timestamps.Timestamp’>

#pd.to_datetime生成自定义时间序列

dtlist=pd.to_datetime([“2019-1-1 0:1:1”, “2019-3-1 0:1:1”])

print(f’pd.to_datetime()-list:{dtlist}')

#pd.to_datetime()-list:DatetimeIndex([‘2019-01-01 00:01:01’, ‘2019-03-01 00:01:01’], dtype=‘datetime64[ns]’, freq=None)

#时间戳转换为period月时期

pr = ts.to_period(‘M’)

print(f’ts.to_period():{pr}')

#ts.to_period():2019-01

print(f’pd.to_period()-type:{type(pr)}')

#pd.to_period()-type:<class ‘pandas._libs.tslibs.period.Period’>

3、生成period对象及转换

#定义时期period

per=pd.Period(‘2019’)

print(f’pd.Period():{per}')

#pd.Period():2019

per_del=pd.Period(‘2019’)-pd.Period(‘2018’)

print(f’2019和2018间隔{per_del}年’)#可以直接+、-整数(代表年)

#2019和2018间隔1年

#时期转换为时间戳

print(per.to_timestamp(how=‘end’))#2019-12-31 00:00:00

给大家的福利

零基础入门

对于从来没有接触过网络安全的同学,我们帮你准备了详细的学习成长路线图。可以说是最科学最系统的学习路线,大家跟着这个大的方向学习准没问题。

同时每个成长路线对应的板块都有配套的视频提供:

在这里插入图片描述

因篇幅有限,仅展示部分资料

网络安全面试题

绿盟护网行动

还有大家最喜欢的黑客技术

网络安全源码合集+工具包

所有资料共282G,朋友们如果有需要全套《网络安全入门+黑客进阶学习资源包》,可以扫描下方二维码领取(如遇扫码问题,可以在评论区留言领取哦)~

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化资料的朋友,可以点击这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值