본문 바로가기

Python 응용/DataScience교육_MS_DAT208x

[DAT208x] final lab 1-1 : Section 1: Importing and Summarizing Data

Read and explore your data

 

In this lab, you'll explore a dataset containing information on a university's recent graduates for each department. The URL this dataset can be downloaded from is stored in a variable called recent_grads_url. In this exercise, you'll read in this data using Python's pandas module.

 

Instructions100 XP

  • Import pandas as pd.
  • Read in the data from recent_grads_url (which is a CSV file) and assign it to a variable called recent_grads.
  • Print the shape of recent_grads.

 

In [5]: # Import pandas
        import pandas as pd
       
        # Use pandas to read in recent_grads_url
        recent_grads = pd.read_csv(recent_grads_url)
       
        # Print the shape
        print(recent_grads.shape)
(173, 21)

In [3]: # Import pandas

        import pandas as pd
       
        # Use pandas to read in recent_grads_url
        recent_grads = pd.read_csv(recent_grads_url, index_col=0)
       
        # Print the shape
        print(recent_grads)
      major_code                                          major  \
rank                                                             
1           2419                          PETROLEUM ENGINEERING  
2           2416                 MINING AND MINERAL ENGINEERING  
3           2415                      METALLURGICAL ENGINEERING  
4           2417      NAVAL ARCHITECTURE AND MARINE ENGINEERING  
5           2405                           CHEMICAL ENGINEERING  
6           2418                            NUCLEAR ENGINEERING  
7           6202                              ACTUARIAL SCIENCE  
8           5001                     ASTRONOMY AND ASTROPHYSICS  
9           2414                         MECHANICAL ENGINEERING  
10          2408                         ELECTRICAL ENGINEERING  
11          2407                           COMPUTER ENGINEERING  
12          2401                          AEROSPACE ENGINEERING  
13          2404                         BIOMEDICAL ENGINEERING  
14          5008                              MATERIALS SCIENCE  
15          2409      ENGINEERING MECHANICS PHYSICS AND SCIENCE  
16          2402                         BIOLOGICAL ENGINEERING  
17          2412       INDUSTRIAL AND MANUFACTURING ENGINEERING  
18          2400                            GENERAL ENGINEERING  
19          2403                      ARCHITECTURAL ENGINEERING  
20          3201                                COURT REPORTING  
21          2102                               COMPUTER SCIENCE  
22          1104                                   FOOD SCIENCE  
23          2502              ELECTRICAL ENGINEERING TECHNOLOGY  
24          2413    MATERIALS ENGINEERING AND MATERIALS SCIENCE  
25          6212  MANAGEMENT INFORMATION SYSTEMS AND STATISTICS  
26          2406                              CIVIL ENGINEERING  
27          5601                          CONSTRUCTION SERVICES  
28          6204            OPERATIONS LOGISTICS AND E-COMMERCE  
29          2499                      MISCELLANEOUS ENGINEERING  
30          5402                                  PUBLIC POLICY  
...          ...                                            ...  
144         1105                     PLANT SCIENCE AND AGRONOMY  
145         2308         SCIENCE AND COMPUTER TEACHER EDUCATION  
146         5200                                     PSYCHOLOGY  
147         6002                                          MUSIC  
148         2306         PHYSICAL AND HEALTH EDUCATION TEACHING  
149         6006                      ART HISTORY AND CRITICISM  
150         6000                                      FINE ARTS  
151         2901                   FAMILY AND CONSUMER SCIENCES  
152         5404                                    SOCIAL WORK  
153         1103                                ANIMAL SCIENCES  
154         6003                     VISUAL AND PERFORMING ARTS  
155         2312             TEACHER EDUCATION: MULTIPLE LEVELS  
156         5299                       MISCELLANEOUS PSYCHOLOGY  
157         5403      HUMAN SERVICES AND COMMUNITY ORGANIZATION  
158         3402                                     HUMANITIES  
159         4901               THEOLOGY AND RELIGIOUS VOCATIONS  
160         6007                                    STUDIO ARTS  
161         2201         COSMETOLOGY SERVICES AND CULINARY ARTS  
162         1199                      MISCELLANEOUS AGRICULTURE  
163         5502                    ANTHROPOLOGY AND ARCHEOLOGY  
164         6102  COMMUNICATION DISORDERS SCIENCES AND SERVICES  
165         2307                      EARLY CHILDHOOD EDUCATION  
166         2603                        OTHER FOREIGN LANGUAGES  
167         6001                         DRAMA AND THEATER ARTS  
168         3302                       COMPOSITION AND RHETORIC  
169         3609                                        ZOOLOGY  
170         5201                         EDUCATIONAL PSYCHOLOGY  
171         5202                            CLINICAL PSYCHOLOGY  
172         5203                          COUNSELING PSYCHOLOGY  
173         3501                                LIBRARY SCIENCE  

                           major_category   total  sample_size    men   women  \
rank                                                                           
1                             Engineering    2339           36   2057     282  
2                             Engineering     756            7    679      77  
3                             Engineering     856            3    725     131  
4                             Engineering    1258           16   1123     135  
5                             Engineering   32260          289  21239   11021  
6                             Engineering    2573           17   2200     373  
7                                Business    3777           51    832     960  
8                       Physical Sciences    1792           10   2110    1667  
9                             Engineering   91227         1029  12953    2105  
10                            Engineering   81527          631   8407    6548  
11                            Engineering   41542          399  33258    8284  
12                            Engineering   15058          147  65511   16016  
13                            Engineering   14955           79  80320   10907  
14                            Engineering    4279           22   2949    1330  
15                            Engineering    4321           30   3526     795  
16                            Engineering    8925           55   6062    2863  
17                            Engineering   18968          183  12453    6515  
18                            Engineering   61152          425  45683   15469  
19                            Engineering    2825           26   1835     990  
20                    Law & Public Policy    1148           14    877     271  
21                Computers & Mathematics  128319         1196   1837    2524  
22        Agriculture & Natural Resources    4361           36  99743   28576  
23                            Engineering   11565           97   2020     973  
24                            Engineering    2993           22   8181    3384  
25                               Business   18713          278  13496    5217  
26                            Engineering   53153          565  41081   12072  
27    Industrial Arts & Consumer Services   18498          295   2662    1385  
28                               Business   11732          156    488     232  
29                            Engineering    9133          118   7398    1735  
30                    Law & Public Policy    5978           55   2695     905  
...                                   ...     ...          ...    ...     ...  
144       Agriculture & Natural Resources    7416          110   5079    7841  
145                             Education    6483           59  22357   16404  
146              Psychology & Social Work  393735         2584  86648  307087  
147                                  Arts   60633          419  15670   12543  
148                             Education   28213          259  29909   30724  
149             Humanities & Liberal Arts   21030          204   3240   17790  
150                                  Arts   74440          623  24786   49654  
151   Industrial Arts & Consumer Services   58001          518   5347   16226  
152              Psychology & Social Work   53552          374   2734   11709  
153       Agriculture & Natural Resources   21573          255   5166   52835  
154                                  Arts   16250          132   2013    4639  
155                             Education   14443          142   1936    7692  
156              Psychology & Social Work    9628           60    885    8489  
157              Psychology & Social Work    9374           89   5137   48415  
158             Humanities & Liberal Arts    6652           49   4133   12117  
159             Humanities & Liberal Arts   30207          310    404    1084  
160                                  Arts   16977          182   4364    6146  
161   Industrial Arts & Consumer Services   10510          117  18616   11591  
162       Agriculture & Natural Resources    1488           24   4754   12223  
163             Humanities & Liberal Arts   38844          247   1167   36422  
164                                Health   38279           95  11376   27468  
165                             Education   37589          342   1225   37054  
166             Humanities & Liberal Arts   11204           56   3472    7732  
167                                  Arts   43249          357   7022   11931  
168             Humanities & Liberal Arts   18953          151  14440   28809  
169                Biology & Life Science    8409           47   3050    5359  
170              Psychology & Social Work    2854            7    522    2332  
171              Psychology & Social Work    2838           13    568    2270  
172              Psychology & Social Work    4626           21    931    3695  
173                             Education    1098            2    134     964  

      sharewomen  employed  full_time  part_time  full_time_year_round  \
rank                                                                    
1       0.120564      1976       1849        270                  1207  
2       0.101852       640        556        170                   388  
3       0.153037       648        558        133                   340  
4       0.107313       758       1069        150                   692  
5       0.341631     25694      23170       5180                 16697  
6       0.144967      1857       2038        264                  1449  
7       0.535714      2912       2924        296                  2482  
8       0.441356      1526       1085        553                   827  
9       0.139793     76442      71298      13101                 54639  
10      0.437847     61928      55450      12695                 41413  
11      0.199413     32506      30315       5146                 23621  
12      0.196450     11391      11106       2724                  8790  
13      0.119559     10047       9017       2694                  5986  
14      0.310820      3307       2751        878                  1967  
15      0.183985      3608       2999        811                  2004  
16      0.320784      6170       5455       1983                  3413  
17      0.343473     15604      14879       2243                 11326  
18      0.252960     44931      41235       7199                 33540  
19      0.350442      2575       2277        343                  1848  
20      0.236063       930        808        223                   808  
21      0.578766    102087      91485      18726                 70932  
22      0.222695      3149       2558       1121                  1735  
23      0.325092      8587       7530       1873                  5681  
24      0.292607      2449       1658       1040                  1151  
25      0.278790     16413      15141       2420                 13017  
26      0.227118     43041      38302      10080                 29196  
27      0.342229     16318      15690       1751                 12313  
28      0.322222     10027       9639       1183                  7724  
29      0.189970      7428       6811       1662                  5476  
30      0.251389      4547       4163       1306                  2776  
...          ...       ...        ...        ...                   ...  
144     0.606889      6594       5798       1246                  4522  
145     0.423209      5362       4764       1227                  3247  
146     0.779933    307933     233205     115172                174438  
147     0.444582     47662      29010      24943                 21425  
148     0.506721     23794      19420       7230                 13651  
149     0.845934     17579      13262       6140                  9965  
150     0.667034     59679      42764      23656                 31877  
151     0.752144     46624      36747      15872                 26906  
152     0.810704     45038      34941      13481                 27588  
153     0.910933     17112      14479       5353                 10824  
154     0.697384     12870       8447       6253                  6322  
155     0.798920     13076      11734       2214                  8457  
156     0.905590      7653       5201       3221                  3838  
157     0.904075      8294       6455       2405                  5061  
158     0.745662      5052       3565       2225                  2661  
159     0.728495     24202      18079       8767                 13944  
160     0.584776     13908      10451       5673                  7413  
161     0.383719      8650       7662       2064                  5949  
162     0.719974      1290       1098        335                   936  
163     0.968954     29633      20147      14515                 13232  
164     0.707136     29763      19975      13862                 14460  
165     0.967998     32551      27569       7001                 20748  
166     0.690111      7052       5197       3685                  3214  
167     0.629505     36165      25147      15994                 16891  
168     0.666119     15053      10121       6612                  7832  
169     0.637293      6259       5043       2190                  3602  
170     0.817099      2125       1848        572                  1211  
171     0.799859      2101       1724        648                  1293  
172     0.798746      3777       3154        965                  2738  
173     0.877960       742        593        237                   410  

      unemployed  unemployment_rate  median  p25th   p75th  college_jobs  \
rank                                                                      
1             37           0.018381  110000  95000  125000          1534  
2             85           0.117241   75000  55000   90000           350  
3             16           0.024096   73000  50000  105000           456  
4             40           0.050125   70000  43000   80000           529  
5           1672           0.061098   65000  50000   75000         18314  
6            400           0.177226   65000  50000  102000          1142  
7            308           0.095652      UN     UN      UN          1768  
8             33           0.021167   62000  31500  109000           972  
9           4650           0.057342   60000  48000   70000         52844  
10          3895           0.059174   60000  45000   72000         45829  
11          2275           0.065409   60000  45000   75000         23694  
12           794           0.065162   60000  42000   70000          8184  
13          1019           0.092084   60000  36000   70000          6439  
14            78           0.023043   60000  39000   65000          2626  
15            23           0.006334   58000  25000   74000          2439  
16           589           0.087143   57100  40000   76000          3603  
17           699           0.042876   57000  37900   67000          8306  
18          2859           0.059824   56000  36000   69000         26898  
19           170           0.061931   54000  38000   65000          1665  
20            11           0.011690   54000  50000   54000           402  
21          6884           0.063173   53000  39000   70000         68622  
22           338           0.096931   53000  32000   70000          1183  
23           824           0.087557   52000  35000   60000          5126  
24            70           0.027789   52000  35000   62000          1911  
25          1015           0.058240   51000  38000   60000          6342  
26          3270           0.070610   50000  40000   60000         28526  
27          1042           0.060023   50000  36000   60000          3275  
28           504           0.047859   50000  40000   60000          1466  
29           597           0.074393   50000  39000   65000          3445  
30           670           0.128426   50000  35000   70000          1550  
...          ...                ...     ...    ...     ...           ...  
144          314           0.045455   32000  22900   40000          2089  
145          266           0.047264   32000  28000   39000          4214  
146        28169           0.083811   31500  24000   41000        125148  
147         3918           0.075960   31000  22300   42000         13752  
148         1920           0.074667   31000  24000   40000         12777  
149         1128           0.060298   31000  23000   40000          5139  
150         5486           0.084186   30500  21000   41000         20792  
151         3355           0.067128   30000  22900   40000         20985  
152         3329           0.068828   30000  25000   35000         27449  
153          917           0.050862   30000  22000   40000          5443  
154         1465           0.102197   30000  22000   40000          3849  
155          496           0.036546   30000  24000   37000         10766  
156          419           0.051908   30000  20800   40000          2960  
157          326           0.037819   30000  24000   35000          2878  
158          372           0.068584   30000  20000   49000          1168  
159         1617           0.062628   29000  22000   38000          9927  
160         1368           0.089552   29000  19200   38300          3948  
161          510           0.055677   29000  20000   36000           563  
162           82           0.059767   29000  23000   42100           483  
163         3395           0.102792   28000  20000   38000          9805  
164         1487           0.047584   28000  20000   40000         19957  
165         1360           0.040105   28000  21000   35000         23515  
166          846           0.107116   27500  22900   38000          2326  
167         3040           0.077541   27000  19200   35000          6994  
168         1340           0.081742   27000  20000   35000          4855  
169          304           0.046320   26000  20000   39000          2771  
170          148           0.065112   25000  24000   34000          1488  
171          368           0.149048   25000  25000   40000           986  
172          214           0.053621   23400  19200   26000          2403  
173           87           0.104946   22000  20000   22000           288  

      non_college_jobs  low_wage_jobs 
rank                                  
1                  364            193 
2                  257             50 
3                  176              0 
4                  102              0 
5                 4440            972 
6                  657            244 
7                  314            259 
8                  500            220 
9                16384           3253 
10               10874           3170 
11                5721            980 
12                2425            372 
13                2471            789 
14                 391             81 
15                 947            263 
16                1595            524 
17                3235            640 
18               11734           3192 
19                 649            137 
20                 528            144 
21               25667           5144 
22                1274            485 
23                2686            696 
24                 305             70 
25                5741            708 
26                9356           2899 
27                5351            703 
28                3629            285 
29                2426            365 
30                1871            340 
...                ...            ... 
144               3545           1231 
145               1106            591 
146             141860          48207 
147              28786           9286 
148               9328           2042 
149               9738           3426 
150              32725          11880 
151              20133           5248 
152              14416           4344 
153               9571           2125 
154               7635           2840 
155               1949            722 
156               3948           1650 
157               4595            724 
158               3354           1141 
159              12037           3304 
160               8707           3586 
161               7384           3163 
162                626             31 
163              16693           6866 
164               9404           5125 
165               7705           2868 
166               3703           1115 
167              25313          11068 
168               8100           3466 
169               2947            743 
170                615             82 
171                870            622 
172               1245            308 
173                338            192 

[173 rows x 20 columns]