Pandas读取表格数据进行处理
import pandas as pd df_policy = pd.read_excel(‘e:\policy.xlsx‘) df_sh01 = pd.read_csv(‘e:\sh01.csv‘, encoding=‘gbk‘) list_not = [] set_found = set() for i in range(df_sh01[‘目的IP‘].__len__()): flag = True for j in range(df_policy[‘目标地址‘].__len__()): if df_sh01[‘目的IP‘][i] in df_policy[‘目标地址‘][j] and str(df_sh01[‘目的端口‘][i]) in df_policy[‘协议-端口‘][j]: flag = False set_found.add(df_policy[‘ID‘][j]) if flag: list_not.append([df_sh01[‘目的IP‘][i], df_sh01[‘目的端口‘][i]]) pd.DataFrame(list_not).to_csv(‘e:\out.csv‘) print(list_not.__len__()) print(set_found.__len__(), set_found)
相关推荐
三石 2020-10-30
roamer 2020-10-29
三石 2020-10-29
wangquannuaa 2020-10-15
wangquannuaa 2020-09-29
jzlixiao 2020-09-15
wangquannuaa 2020-08-30
三石 2020-08-23
逍遥友 2020-08-21
jzlixiao 2020-08-18
wangquannuaa 2020-08-17
QianYanDai 2020-08-16
cjsyrwt 2020-08-14
jzlixiao 2020-07-29
xirongxudlut 2020-07-20
mmmjyjy 2020-07-16
QianYanDai 2020-07-05
QianYanDai 2020-07-05
june0 2020-07-04