Skip to content

Commit 4778c27

Browse files
committed
Update on step12 of Occupation exercise code solution
1 parent 19e2e12 commit 4778c27

File tree

3 files changed

+51
-36
lines changed

3 files changed

+51
-36
lines changed

01_Getting_&_Knowing_Your_Data/Occupation/Exercise_with_Solution.ipynb

Lines changed: 45 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
{
2121
"cell_type": "code",
22-
"execution_count": 4,
22+
"execution_count": 1,
2323
"metadata": {
2424
"collapsed": false
2525
},
@@ -44,7 +44,7 @@
4444
},
4545
{
4646
"cell_type": "code",
47-
"execution_count": 5,
47+
"execution_count": 2,
4848
"metadata": {
4949
"collapsed": false
5050
},
@@ -63,7 +63,7 @@
6363
},
6464
{
6565
"cell_type": "code",
66-
"execution_count": 6,
66+
"execution_count": 3,
6767
"metadata": {
6868
"collapsed": false,
6969
"scrolled": true
@@ -300,7 +300,7 @@
300300
"25 39 M engineer 55107"
301301
]
302302
},
303-
"execution_count": 6,
303+
"execution_count": 3,
304304
"metadata": {},
305305
"output_type": "execute_result"
306306
}
@@ -318,7 +318,7 @@
318318
},
319319
{
320320
"cell_type": "code",
321-
"execution_count": 6,
321+
"execution_count": 4,
322322
"metadata": {
323323
"collapsed": false,
324324
"scrolled": true
@@ -435,7 +435,7 @@
435435
"943 22 M student 77841"
436436
]
437437
},
438-
"execution_count": 6,
438+
"execution_count": 4,
439439
"metadata": {},
440440
"output_type": "execute_result"
441441
}
@@ -482,7 +482,7 @@
482482
},
483483
{
484484
"cell_type": "code",
485-
"execution_count": 7,
485+
"execution_count": 6,
486486
"metadata": {
487487
"collapsed": false
488488
},
@@ -493,7 +493,7 @@
493493
"4"
494494
]
495495
},
496-
"execution_count": 7,
496+
"execution_count": 6,
497497
"metadata": {},
498498
"output_type": "execute_result"
499499
}
@@ -511,7 +511,7 @@
511511
},
512512
{
513513
"cell_type": "code",
514-
"execution_count": 8,
514+
"execution_count": 7,
515515
"metadata": {
516516
"collapsed": false
517517
},
@@ -522,7 +522,7 @@
522522
"Index([u'age', u'gender', u'occupation', u'zip_code'], dtype='object')"
523523
]
524524
},
525-
"execution_count": 8,
525+
"execution_count": 7,
526526
"metadata": {},
527527
"output_type": "execute_result"
528528
}
@@ -540,7 +540,7 @@
540540
},
541541
{
542542
"cell_type": "code",
543-
"execution_count": 13,
543+
"execution_count": 8,
544544
"metadata": {
545545
"collapsed": false
546546
},
@@ -554,7 +554,7 @@
554554
" dtype='int64', name=u'user_id', length=943)"
555555
]
556556
},
557-
"execution_count": 13,
557+
"execution_count": 8,
558558
"metadata": {},
559559
"output_type": "execute_result"
560560
}
@@ -573,7 +573,7 @@
573573
},
574574
{
575575
"cell_type": "code",
576-
"execution_count": 10,
576+
"execution_count": 9,
577577
"metadata": {
578578
"collapsed": false
579579
},
@@ -588,7 +588,7 @@
588588
"dtype: object"
589589
]
590590
},
591-
"execution_count": 10,
591+
"execution_count": 9,
592592
"metadata": {},
593593
"output_type": "execute_result"
594594
}
@@ -606,7 +606,7 @@
606606
},
607607
{
608608
"cell_type": "code",
609-
"execution_count": 17,
609+
"execution_count": 10,
610610
"metadata": {
611611
"collapsed": false
612612
},
@@ -679,7 +679,7 @@
679679
"Name: occupation, dtype: object"
680680
]
681681
},
682-
"execution_count": 17,
682+
"execution_count": 10,
683683
"metadata": {},
684684
"output_type": "execute_result"
685685
}
@@ -701,7 +701,7 @@
701701
},
702702
{
703703
"cell_type": "code",
704-
"execution_count": 20,
704+
"execution_count": 14,
705705
"metadata": {
706706
"collapsed": false
707707
},
@@ -712,13 +712,13 @@
712712
"21"
713713
]
714714
},
715-
"execution_count": 20,
715+
"execution_count": 14,
716716
"metadata": {},
717717
"output_type": "execute_result"
718718
}
719719
],
720720
"source": [
721-
"len(users.occupation.unique())"
721+
"users.occupation.nunique()"
722722
]
723723
},
724724
{
@@ -730,7 +730,7 @@
730730
},
731731
{
732732
"cell_type": "code",
733-
"execution_count": 33,
733+
"execution_count": 15,
734734
"metadata": {
735735
"collapsed": false
736736
},
@@ -746,7 +746,7 @@
746746
"Name: occupation, dtype: int64"
747747
]
748748
},
749-
"execution_count": 33,
749+
"execution_count": 15,
750750
"metadata": {},
751751
"output_type": "execute_result"
752752
}
@@ -764,7 +764,7 @@
764764
},
765765
{
766766
"cell_type": "code",
767-
"execution_count": 21,
767+
"execution_count": 16,
768768
"metadata": {
769769
"collapsed": false
770770
},
@@ -829,7 +829,7 @@
829829
"max 73.000000"
830830
]
831831
},
832-
"execution_count": 21,
832+
"execution_count": 16,
833833
"metadata": {},
834834
"output_type": "execute_result"
835835
}
@@ -847,7 +847,7 @@
847847
},
848848
{
849849
"cell_type": "code",
850-
"execution_count": 22,
850+
"execution_count": 17,
851851
"metadata": {
852852
"collapsed": false,
853853
"scrolled": true
@@ -964,7 +964,7 @@
964964
"max 73.000000 NaN NaN NaN"
965965
]
966966
},
967-
"execution_count": 22,
967+
"execution_count": 17,
968968
"metadata": {},
969969
"output_type": "execute_result"
970970
}
@@ -982,7 +982,7 @@
982982
},
983983
{
984984
"cell_type": "code",
985-
"execution_count": 34,
985+
"execution_count": 18,
986986
"metadata": {
987987
"collapsed": false
988988
},
@@ -997,7 +997,7 @@
997997
"Name: occupation, dtype: object"
998998
]
999999
},
1000-
"execution_count": 34,
1000+
"execution_count": 18,
10011001
"metadata": {},
10021002
"output_type": "execute_result"
10031003
}
@@ -1015,7 +1015,7 @@
10151015
},
10161016
{
10171017
"cell_type": "code",
1018-
"execution_count": 38,
1018+
"execution_count": 19,
10191019
"metadata": {
10201020
"collapsed": false
10211021
},
@@ -1026,7 +1026,7 @@
10261026
"34.0"
10271027
]
10281028
},
1029-
"execution_count": 38,
1029+
"execution_count": 19,
10301030
"metadata": {},
10311031
"output_type": "execute_result"
10321032
}
@@ -1044,7 +1044,7 @@
10441044
},
10451045
{
10461046
"cell_type": "code",
1047-
"execution_count": 53,
1047+
"execution_count": 20,
10481048
"metadata": {
10491049
"collapsed": false
10501050
},
@@ -1056,7 +1056,7 @@
10561056
"Name: age, dtype: int64"
10571057
]
10581058
},
1059-
"execution_count": 53,
1059+
"execution_count": 20,
10601060
"metadata": {},
10611061
"output_type": "execute_result"
10621062
}
@@ -1067,10 +1067,23 @@
10671067
}
10681068
],
10691069
"metadata": {
1070+
"anaconda-cloud": {},
10701071
"kernelspec": {
1071-
"display_name": "Python 2",
1072+
"display_name": "Python [default]",
10721073
"language": "python",
10731074
"name": "python2"
1075+
},
1076+
"language_info": {
1077+
"codemirror_mode": {
1078+
"name": "ipython",
1079+
"version": 2
1080+
},
1081+
"file_extension": ".py",
1082+
"mimetype": "text/x-python",
1083+
"name": "python",
1084+
"nbconvert_exporter": "python",
1085+
"pygments_lexer": "ipython2",
1086+
"version": "2.7.12"
10741087
}
10751088
},
10761089
"nbformat": 4,

01_Getting_&_Knowing_Your_Data/Occupation/Exercises.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,9 @@
293293
}
294294
],
295295
"metadata": {
296+
"anaconda-cloud": {},
296297
"kernelspec": {
297-
"display_name": "Python 2",
298+
"display_name": "Python [default]",
298299
"language": "python",
299300
"name": "python2"
300301
},
@@ -308,7 +309,7 @@
308309
"name": "python",
309310
"nbconvert_exporter": "python",
310311
"pygments_lexer": "ipython2",
311-
"version": "2.7.11"
312+
"version": "2.7.12"
312313
}
313314
},
314315
"nbformat": 4,

01_Getting_&_Knowing_Your_Data/Occupation/Solutions.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,8 +1027,9 @@
10271027
}
10281028
],
10291029
"metadata": {
1030+
"anaconda-cloud": {},
10301031
"kernelspec": {
1031-
"display_name": "Python 2",
1032+
"display_name": "Python [default]",
10321033
"language": "python",
10331034
"name": "python2"
10341035
},
@@ -1042,7 +1043,7 @@
10421043
"name": "python",
10431044
"nbconvert_exporter": "python",
10441045
"pygments_lexer": "ipython2",
1045-
"version": "2.7.11"
1046+
"version": "2.7.12"
10461047
}
10471048
},
10481049
"nbformat": 4,

0 commit comments

Comments
 (0)