根据我们的定义,“POI”(Person of interest,嫌疑人)特征记录着一个人是否为相关人士的信息。
E+F 数据集中有多少 POI?
练习: 在安然数据中查找 POI
也就是说,计算 data[person_name]["poi"]==1 时,字典中条目的数量。
code:
import pickle enron_data = pickle.load(open("../final_project/final_project_dataset.pkl", "r")) print(len(enron_data)) print(enron_data.keys()) print(len(enron_data['METTS MARK'])) poi_quantity = 0 for key in enron_data.keys(): if enron_data[key] ['poi'] == 1: poi_quantity += 1 print poi_quantity