import pyshark
import os
没有提示
files = os.listdir('./shark_files/')
for file in files:
print(file)
ps = pyshark.FileCapture('./shark_files/' + file , tshark_path='D:/ProgramFiles/Wireshark/Wireshark.exe')
for pkt in ps:
print(pkt)
try:
print('------------------------------------------------------------')
print(pkt.tcp.get_field_by_showname('Source Port'))
print(pkt.bgp.get_field_by_showname('AS2'))
print(pkt.bgp.get_field_by_showname('Type'))
if pkt.IPV6.get_field_by_showname(' Address'): #找ipv6下的三层数据
print(pkt.IPV6.get_field_by_showname('NLRI prefix'))
print(pkt.bgp.get_field_by_showname())
print(pkt.)
except Exception as e:
print(e)
import pandas as pd
df = pd.read_csv('test/train.csv' )
1.查看数据
print(df)
print(df.shape)
print(df.info()) # 获取丢失的信息
print(df.describe())
print(df.head(2))
print(df['年龄'])
print((df.loc[0:4,"姓名":"性别"])) # 区间
print((df.loc[[0,4],["姓名","性别"]])) #指定
2.填充数据
年龄填充最小值,修改Nan
age_min = df['年龄'].min()
df['年龄'] = df ['年龄'].fillna(age_min)
print(df)
df.loc[2, '性别'] = 100
print(df)
df = df.sort_values(by='年龄',ascending=True)
df.to_csv('new.csv',index=)
标签:Network,pkt,get,df,Three,field,Program,print,showname From: https://www.cnblogs.com/heydom/p/18458097