Skip to content

Commit

Permalink
enron key compatibility for Python 3
Browse files Browse the repository at this point in the history
Due to changes in dictionary key order in Python 3, a brief fix has
been created for students using Python 3 over Python 2.
  • Loading branch information
Sheng Kung Yi authored and Sheng Kung Yi committed May 17, 2015
1 parent 15bd5c3 commit 960a6d1
Show file tree
Hide file tree
Showing 2 changed files with 298 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/feature_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ def featureFormat( dictionary, features, remove_NaN=True, remove_all_zeroes=True
return_list = []

if sort_keys:
# keys sorted in alphabetical order for final project compatibility
keys = sorted(dictionary.keys())
else:
# key orders will be different for Python 2 and Python 3; for Python 3
# users, load key order from 'python2_datadictkeys.pkl' using pickle to
# complete assignments.
keys = dictionary.keys()

for key in keys:
Expand Down
294 changes: 294 additions & 0 deletions tools/python2_datadictkeys.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
(lp0
S'METTS MARK'
p1
aS'BAXTER JOHN C'
p2
aS'ELLIOTT STEVEN'
p3
aS'CORDES WILLIAM R'
p4
aS'HANNON KEVIN P'
p5
aS'MORDAUNT KRISTINA M'
p6
aS'MEYER ROCKFORD G'
p7
aS'MCMAHON JEFFREY'
p8
aS'HORTON STANLEY C'
p9
aS'PIPER GREGORY F'
p10
aS'HUMPHREY GENE E'
p11
aS'UMANOFF ADAM S'
p12
aS'BLACHMAN JEREMY M'
p13
aS'SUNDE MARTIN'
p14
aS'GIBBS DANA R'
p15
aS'LOWRY CHARLES P'
p16
aS'COLWELL WESLEY'
p17
aS'MULLER MARK S'
p18
aS'JACKSON CHARLENE R'
p19
aS'WESTFAHL RICHARD K'
p20
aS'WALTERS GARETH W'
p21
aS'WALLS JR ROBERT H'
p22
aS'KITCHEN LOUISE'
p23
aS'CHAN RONNIE'
p24
aS'BELFER ROBERT'
p25
aS'SHANKMAN JEFFREY A'
p26
aS'WODRASKA JOHN'
p27
aS'BERGSIEKER RICHARD P'
p28
aS'URQUHART JOHN A'
p29
aS'BIBI PHILIPPE A'
p30
aS'RIEKER PAULA H'
p31
aS'WHALEY DAVID A'
p32
aS'BECK SALLY W'
p33
aS'HAUG DAVID L'
p34
aS'ECHOLS JOHN B'
p35
aS'MENDELSOHN JOHN'
p36
aS'HICKERSON GARY J'
p37
aS'CLINE KENNETH W'
p38
aS'LEWIS RICHARD'
p39
aS'HAYES ROBERT E'
p40
aS'MCCARTY DANNY J'
p41
aS'KOPPER MICHAEL J'
p42
aS'LEFF DANIEL P'
p43
aS'LAVORATO JOHN J'
p44
aS'BERBERIAN DAVID'
p45
aS'DETMERING TIMOTHY J'
p46
aS'WAKEHAM JOHN'
p47
aS'POWERS WILLIAM'
p48
aS'GOLD JOSEPH'
p49
aS'BANNANTINE JAMES M'
p50
aS'DUNCAN JOHN H'
p51
aS'SHAPIRO RICHARD S'
p52
aS'SHERRIFF JOHN R'
p53
aS'SHELBY REX'
p54
aS'LEMAISTRE CHARLES'
p55
aS'DEFFNER JOSEPH M'
p56
aS'KISHKILL JOSEPH G'
p57
aS'WHALLEY LAWRENCE G'
p58
aS'MCCONNELL MICHAEL S'
p59
aS'PIRO JIM'
p60
aS'DELAINEY DAVID W'
p61
aS'SULLIVAN-SHAKLOVITZ COLLEEN'
p62
aS'WROBEL BRUCE'
p63
aS'LINDHOLM TOD A'
p64
aS'MEYER JEROME J'
p65
aS'LAY KENNETH L'
p66
aS'BUTTS ROBERT H'
p67
aS'OLSON CINDY K'
p68
aS'MCDONALD REBECCA'
p69
aS'CUMBERLAND MICHAEL S'
p70
aS'GAHN ROBERT S'
p71
aS'MCCLELLAN GEORGE'
p72
aS'HERMANN ROBERT J'
p73
aS'SCRIMSHAW MATTHEW'
p74
aS'GATHMANN WILLIAM D'
p75
aS'HAEDICKE MARK E'
p76
aS'BOWEN JR RAYMOND M'
p77
aS'GILLIS JOHN'
p78
aS'FITZGERALD JAY L'
p79
aS'MORAN MICHAEL P'
p80
aS'REDMOND BRIAN L'
p81
aS'BAZELIDES PHILIP J'
p82
aS'BELDEN TIMOTHY N'
p83
aS'DURAN WILLIAM D'
p84
aS'THORN TERENCE H'
p85
aS'FASTOW ANDREW S'
p86
aS'FOY JOE'
p87
aS'CALGER CHRISTOPHER F'
p88
aS'RICE KENNETH D'
p89
aS'KAMINSKI WINCENTY J'
p90
aS'LOCKHART EUGENE E'
p91
aS'COX DAVID'
p92
aS'OVERDYKE JR JERE C'
p93
aS'PEREIRA PAULO V. FERRAZ'
p94
aS'STABLER FRANK'
p95
aS'SKILLING JEFFREY K'
p96
aS'BLAKE JR. NORMAN P'
p97
aS'SHERRICK JEFFREY B'
p98
aS'PRENTICE JAMES'
p99
aS'GRAY RODNEY'
p100
aS'PICKERING MARK R'
p101
aS'THE TRAVEL AGENCY IN THE PARK'
p102
aS'NOLES JAMES L'
p103
aS'KEAN STEVEN J'
p104
aS'TOTAL'
p105
aS'FOWLER PEGGY'
p106
aS'WASAFF GEORGE'
p107
aS'WHITE JR THOMAS E'
p108
aS'CHRISTODOULOU DIOMEDES'
p109
aS'ALLEN PHILLIP K'
p110
aS'SHARP VICTORIA T'
p111
aS'JAEDICKE ROBERT'
p112
aS'WINOKUR JR. HERBERT S'
p113
aS'BROWN MICHAEL'
p114
aS'BADUM JAMES P'
p115
aS'HUGHES JAMES A'
p116
aS'REYNOLDS LAWRENCE'
p117
aS'DIMICHELE RICHARD G'
p118
aS'BHATNAGAR SANJAY'
p119
aS'CARTER REBECCA C'
p120
aS'BUCHANAN HAROLD G'
p121
aS'YEAP SOON'
p122
aS'MURRAY JULIA H'
p123
aS'GARLAND C KEVIN'
p124
aS'DODSON KEITH'
p125
aS'YEAGER F SCOTT'
p126
aS'HIRKO JOSEPH'
p127
aS'DIETRICH JANET R'
p128
aS'DERRICK JR. JAMES V'
p129
aS'FREVERT MARK A'
p130
aS'PAI LOU L'
p131
aS'BAY FRANKLIN R'
p132
aS'HAYSLETT RODERICK J'
p133
aS'FUGH JOHN L'
p134
aS'FALLON JAMES B'
p135
aS'KOENIG MARK E'
p136
aS'SAVAGE FRANK'
p137
aS'IZZO LAWRENCE L'
p138
aS'TILNEY ELIZABETH A'
p139
aS'MARTIN AMANDA K'
p140
aS'BUY RICHARD B'
p141
aS'GRAMM WENDY L'
p142
aS'CAUSEY RICHARD A'
p143
aS'TAYLOR MITCHELL S'
p144
aS'DONAHUE JR JEFFREY M'
p145
aS'GLISAN JR BEN F'
p146
a.

0 comments on commit 960a6d1

Please sign in to comment.