-
-
Save jacobod/7b8c15bf7a4d52889da39fa31e795632 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# creating copy | |
my_dataset = data_dict | |
# creating new features | |
for key in my_dataset: | |
empl = my_dataset[key] | |
perc_to_poi, perc_from_poi = [] , [] | |
if (empl['from_this_person_to_poi'] != 'NaN') & (empl['from_messages'] != 'NaN'): | |
perc_to_poi = float(empl['from_this_person_to_poi'])/float(empl['from_messages']) | |
empl['perc_to_poi'] = perc_to_poi | |
else: | |
empl['perc_to_poi'] = 0 | |
if (empl['from_poi_to_this_person'] != 'NaN') & (empl['to_messages'] != 'NaN'): | |
perc_to_poi = float(empl['from_poi_to_this_person'])/float(empl['to_messages']) | |
empl['perc_from_poi'] = perc_to_poi | |
else: | |
empl['perc_from_poi'] = 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment