In [1]:
%matplotlib inline
from matplotlib import pylab as plt
import pandas as pd
df = pd.read_csv("data/Hospital_Inpatient_Discharges__SPARCS_De-Identified___2012.csv")


/usr/lib/python2.7/site-packages/pandas/io/parsers.py:1070: DtypeWarning: Columns (10,30) have mixed types. Specify dtype option on import or set low_memory=False.
  data = self._reader.read(nrows)

In [2]:
df.columns


Out[2]:
Index([u'Hospital Service Area', u'Hospital County', u'Operating Certificate Number', u'Facility Id', u'Facility Name', u'Age Group', u'Zip Code - 3 digits', u'Gender', u'Race', u'Ethnicity', u'Length of Stay', u'Admit Day of Week', u'Type of Admission', u'Patient Disposition', u'Discharge Year', u'Discharge Day of Week', u'CCS Diagnosis Code', u'CCS Diagnosis Description', u'CCS Procedure Code', u'CCS Procedure Description', u'APR DRG Code', u'APR DRG Description', u'APR MDC Code', u'APR MDC Description', u'APR Severity of Illness Code', u'APR Severity of Illness Description', u'APR Risk of Mortality', u'APR Medical Surgical Description', u'Source of Payment 1', u'Source of Payment 2', u'Source of Payment 3', u'Attending Provider License Number', u'Operating Provider License Number', u'Other Provider License Number', u'Birth Weight', u'Abortion Edit Indicator', u'Emergency Department Indicator', u'Total Charges'], dtype='object')

In [3]:
import string
tbl = string.maketrans("", "")

df['Total Charges'] = df['Total Charges'].apply(lambda x: float(x.translate(tbl, "$")))

In [4]:
df["Total Charges"].sum()


Out[4]:
84374462640.481461

In [5]:
df['Total Charges'].hist(bins=200, figsize=(16., 10.))


Out[5]:
<matplotlib.axes.AxesSubplot at 0x39822250>

In [44]:
len(df)


Out[44]:
2529422

In [6]:
df[df['Total Charges'] < 250000]['Total Charges'].hist(bins=200 ,figsize=(16., 10.))


Out[6]:
<matplotlib.axes.AxesSubplot at 0x5f89690>

In [43]:
df[df['Total Charges'] < 50000]['Total Charges'].hist(bins=200 ,figsize=(16., 10.))


Out[43]:
<matplotlib.axes.AxesSubplot at 0xba098d0>

In [7]:
from pprint import pprint
pprint(list(df.columns))


['Hospital Service Area',
 'Hospital County',
 'Operating Certificate Number',
 'Permanent Facility Id',
 'Facility Name',
 'Age Group',
 'Zip Code - 3 digits',
 'Gender',
 'Race',
 'Ethnicity',
 'Length of Stay',
 'Admit Day of Week',
 'Type of Admission',
 'Patient Disposition',
 'Discharge Year',
 'Discharge Day of Week',
 'CCS Diagnosis Code',
 'CCS Diagnosis Description',
 'CCS Procedure Code',
 'CCS Procedure Description',
 'APR DRG Code',
 'APR DRG Description',
 'APR MDC Code',
 'APR MDC Description',
 'APR Severity of Illness Code',
 'APR Severity of Illness Descript',
 'APR Risk of Mortality',
 'APR Medical Surgical Description',
 'Source of Payment 1',
 'Source of Payment 2',
 'Source of Payment 3',
 'Attending Provider License Numbe',
 'Operating Provider License Numbe',
 'Other Provider License Number',
 'Birth Weight',
 'Abortion Edit Indicator',
 'Emergency Department Indicator',
 'Total Charges']

In [8]:
df.groupby(['Hospital County', 'Type of Admission']).size()


Out[8]:
Hospital County  Type of Admission
Albany           Elective              16902
                 Emergency             34936
                 Newborn                4701
                 Not Available             3
                 Urgent                 5130
Allegheny        Elective                450
                 Emergency              1148
                 Newborn                 272
                 Not Available             1
                 Urgent                  215
Bronx            Elective              18645
                 Emergency            149795
                 Newborn               15286
                 Not Available             2
                 Trauma                  313
...
Wayne            Not Available           31
                 Urgent                 204
Westchester      Elective             32359
                 Emergency            77855
                 Newborn              10381
                 Not Available           41
                 Trauma                  11
                 Urgent                6497
Wyoming          Elective               203
                 Emergency             1737
                 Newborn                199
                 Urgent                 304
Yates            Elective                57
                 Emergency              313
                 Urgent                 537
Length: 269, dtype: int64

In [9]:
df


Out[9]:
Hospital Service Area Hospital County Operating Certificate Number Permanent Facility Id Facility Name Age Group Zip Code - 3 digits Gender Race Ethnicity Length of Stay Admit Day of Week Type of Admission Patient Disposition Discharge Year Discharge Day of Week CCS Diagnosis Code CCS Diagnosis Description CCS Procedure Code CCS Procedure Description
0 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 30 to 49 147 F White Not Span/Hispanic 4 THU Elective Home or Self Care 2012 MON 122 PNEUMONIA 0 NO PROC ...
1 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 4 FRI Urgent Short-term Hospital 2012 TUE 197 SKIN/SUBCUT TISS INFECT 0 NO PROC ...
2 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 30 to 49 147 F White Not Span/Hispanic 3 SUN Urgent Home or Self Care 2012 WED 122 PNEUMONIA 0 NO PROC ...
3 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 0 to 17 147 F White Not Span/Hispanic 1 MON Urgent Home or Self Care 2012 TUE 122 PNEUMONIA 0 NO PROC ...
4 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 3 FRI Elective Home or Self Care 2012 MON 122 PNEUMONIA 0 NO PROC ...
5 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 0 to 17 147 F White Not Span/Hispanic 1 MON Elective Home or Self Care 2012 TUE 142 APPENDICITIS 0 NO PROC ...
6 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 18 to 29 147 M White Not Span/Hispanic 3 MON Elective Home or Self Care 2012 THU 122 PNEUMONIA 0 NO PROC ...
7 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 1 SAT Elective Home or Self Care 2012 SUN 154 GASTROENTRTS NONINFCT 202 ELECTROCARDIOGRAM ...
8 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 0 to 17 147 M White Not Span/Hispanic 1 TUE Elective Home or Self Care 2012 WED 125 BRONCHITIS 0 NO PROC ...
9 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 M White Not Span/Hispanic 2 TUE Elective Home or Self Care 2012 THU 122 PNEUMONIA 0 NO PROC ...
10 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 F White Not Span/Hispanic 2 FRI Elective Home or Self Care 2012 SUN 127 COPD 0 NO PROC ...
11 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 M White Not Span/Hispanic 2 SUN Elective Home or Self Care 2012 TUE 122 PNEUMONIA 202 ELECTROCARDIOGRAM ...
12 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 30 to 49 147 M Other Race Not Span/Hispanic 2 MON Elective Home or Self Care 2012 WED 126 OTHR UPPR RESP INFECTN 0 NO PROC ...
13 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 M White Not Span/Hispanic 4 MON Elective Home or Self Care 2012 FRI 122 PNEUMONIA 202 ELECTROCARDIOGRAM ...
14 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 F White Not Span/Hispanic 2 MON Elective Home or Self Care 2012 WED 126 OTHR UPPR RESP INFECTN 0 NO PROC ...
15 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 18 to 29 147 F White Not Span/Hispanic 2 THU Elective Home or Self Care 2012 SAT 159 URINARY TRACT INFECTION 0 NO PROC ...
16 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 30 to 49 147 M White Spanish/Hispanic 3 MON Urgent Home or Self Care 2012 THU 126 OTHR UPPR RESP INFECTN 0 NO PROC ...
17 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 30 to 49 148 F White Not Span/Hispanic 4 TUE Urgent Home or Self Care 2012 SAT 122 PNEUMONIA 0 NO PROC ...
18 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 5 WED Elective Hosp Basd Medicare Approved Swing Bed 2012 MON 122 PNEUMONIA 202 ELECTROCARDIOGRAM ...
19 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 M White Not Span/Hispanic 4 WED Urgent Home or Self Care 2012 SUN 231 OTHER FRACTURE 0 NO PROC ...
20 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 3 SAT Elective Hosp Basd Medicare Approved Swing Bed 2012 TUE 145 INTESTINAL OBSTRUCTION 0 NO PROC ...
21 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 M White Not Span/Hispanic 2 SAT Urgent Home or Self Care 2012 MON 238 SURGCL/MED CARE COMPL 0 NO PROC ...
22 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 0 to 17 148 M White Not Span/Hispanic 1 SAT Urgent Home or Self Care 2012 SUN 122 PNEUMONIA 0 NO PROC ...
23 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 F White Not Span/Hispanic 2 SUN Elective Home or Self Care 2012 TUE 146 DIVERTICUL-OSIS/ITIS 0 NO PROC ...
24 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 30 to 49 147 F White Not Span/Hispanic 3 FRI Elective Home or Self Care 2012 MON 197 SKIN/SUBCUT TISS INFECT 0 NO PROC ...
25 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 4 THU Urgent Hosp Basd Medicare Approved Swing Bed 2012 MON 122 PNEUMONIA 0 NO PROC ...
26 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 OOS M White Not Span/Hispanic 3 SAT Elective Home or Self Care 2012 TUE 122 PNEUMONIA 0 NO PROC ...
27 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 OOS F White Not Span/Hispanic 4 TUE Urgent Home or Self Care 2012 SAT 122 PNEUMONIA 0 NO PROC ...
28 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 M White Not Span/Hispanic 2 SAT Elective Home or Self Care 2012 MON 127 COPD 0 NO PROC ...
29 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 30 to 49 OOS F White Not Span/Hispanic 1 WED Elective Short-term Hospital 2012 THU 244 OTHER INJURY/COND 0 NO PROC ...
30 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 2 WED Urgent Home or Self Care 2012 FRI 154 GASTROENTRTS NONINFCT 0 NO PROC ...
31 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 F White Not Span/Hispanic 2 WED Urgent Home or Self Care 2012 FRI 127 COPD 0 NO PROC ...
32 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 18 to 29 147 M White Not Span/Hispanic 2 MON Urgent Home or Self Care 2012 WED 122 PNEUMONIA 0 NO PROC ...
33 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Spanish/Hispanic 1 WED Urgent Home or Self Care 2012 THU 122 PNEUMONIA 0 NO PROC ...
34 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 18 to 29 147 F White Not Span/Hispanic 2 FRI Urgent Home or Self Care 2012 SUN 154 GASTROENTRTS NONINFCT 0 NO PROC ...
35 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 30 to 49 147 F White Not Span/Hispanic 2 SAT Urgent Home or Self Care 2012 MON 122 PNEUMONIA 0 NO PROC ...
36 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 0 to 17 147 M White Not Span/Hispanic 2 MON Elective Home or Self Care 2012 WED 154 GASTROENTRTS NONINFCT 0 NO PROC ...
37 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 M White Not Span/Hispanic 2 WED Urgent Home or Self Care 2012 FRI 127 COPD 0 NO PROC ...
38 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 M White Not Span/Hispanic 4 THU Elective Home or Self Care 2012 MON 231 OTHER FRACTURE 202 ELECTROCARDIOGRAM ...
39 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 2 THU Elective Home or Self Care 2012 SAT 127 COPD 0 NO PROC ...
40 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 3 SAT Urgent Home or Self Care 2012 TUE 122 PNEUMONIA 0 NO PROC ...
41 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 F White Not Span/Hispanic 2 THU Elective Home or Self Care 2012 SAT 146 DIVERTICUL-OSIS/ITIS 0 NO PROC ...
42 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 F White Not Span/Hispanic 1 FRI Elective Home or Self Care 2012 SAT 146 DIVERTICUL-OSIS/ITIS 0 NO PROC ...
43 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 1 FRI Elective Short-term Hospital 2012 SAT 153 GI HEMORRHAGE 0 NO PROC ...
44 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 1 MON Elective Home or Self Care 2012 TUE 122 PNEUMONIA 0 NO PROC ...
45 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 18 to 29 147 F White Not Span/Hispanic 1 THU Elective Home or Self Care 2012 FRI 154 GASTROENTRTS NONINFCT 0 NO PROC ...
46 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 F White Not Span/Hispanic 3 SUN Elective Home or Self Care 2012 WED 127 COPD 0 NO PROC ...
47 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 140 F White Not Span/Hispanic 1 MON Elective Home or Self Care 2012 TUE 127 COPD 0 NO PROC ...
48 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 M White Not Span/Hispanic 2 MON Urgent Home or Self Care 2012 WED 127 COPD 0 NO PROC ...
49 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 18 to 29 147 F White Not Span/Hispanic 1 TUE Elective Home or Self Care 2012 WED 159 URINARY TRACT INFECTION 0 NO PROC ...
50 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 M White Not Span/Hispanic 2 FRI Elective Home or Self Care 2012 SUN 127 COPD 0 NO PROC ...
51 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 M White Not Span/Hispanic 2 SUN Elective Home or Self Care 2012 TUE 122 PNEUMONIA 202 ELECTROCARDIOGRAM ...
52 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 30 to 49 147 F White Not Span/Hispanic 2 TUE Elective Home or Self Care 2012 THU 154 GASTROENTRTS NONINFCT 0 NO PROC ...
53 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 148 F White Not Span/Hispanic 6 TUE Elective Home or Self Care 2012 MON 197 SKIN/SUBCUT TISS INFECT 0 NO PROC ...
54 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 50 to 69 147 F White Not Span/Hispanic 2 SAT Elective Home or Self Care 2012 MON 128 ASTHMA 202 ELECTROCARDIOGRAM ...
55 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 30 to 49 147 F White Not Span/Hispanic 2 TUE Elective Home or Self Care 2012 THU 127 COPD 0 NO PROC ...
56 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 0 to 17 147 M White Not Span/Hispanic 2 WED Elective Home or Self Care 2012 FRI 128 ASTHMA 0 NO PROC ...
57 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 3 WED Elective Home or Self Care 2012 SAT 127 COPD 0 NO PROC ...
58 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 2 SUN Elective Home or Self Care 2012 TUE 155 OTHER GI DISORDER 0 NO PROC ...
59 Western NY Allegheny 226700 37 Cuba Memorial Hospital Inc 70 or Older 147 F White Not Span/Hispanic 1 SUN Elective Home or Self Care 2012 MON 55 FLUID/ELECTRLYT DISORDR 0 NO PROC ...
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...

2529422 rows × 38 columns


In [14]:
import numpy as np
from IPython.html.widgets import interact

plt.rcParams.update({'font.size': 20, 'font.family': 'STIXGeneral', 'mathtext.fontset': 'stix'})

def by_county(county='Albany'):
    status_counts = df.groupby(['Hospital County', 'Type of Admission']).size().ix[county]

    cmap = plt.cm.summer
    colors = cmap(np.linspace(0., 1., len(status_counts)))

    fig, ax = plt.subplots(figsize=(10.0, 10.0))

    ax.pie(status_counts, autopct=lambda p: '{0:.1f}% ({1:})'. format(p, int(p * sum(status_counts) / 100)), 
               labels=status_counts.index, colors=colors)
    fig.suptitle("{}".format(county))
    plt.show()
    
    
# by_county("Albany")
i = interact(by_county, county=list(df['Hospital County'].dropna().unique()))



In [45]:
df['Age Group'].unique()


Out[45]:
array(['30 to 49', '70 or Older', '0 to 17', '18 to 29', '50 to 69'], dtype=object)

In [16]:
def by_county_with_0to17(county='Albany'):
    status_counts = df.groupby(['Hospital County', 'Type of Admission']).size().ix[county]
    status_counts_17 = df[df['Age Group'] == '0 to 17'].groupby(['Hospital County', 'Type of Admission']).size().ix[county]
        
    cmap = plt.cm.summer
    colors = cmap(np.linspace(0., 1., len(status_counts)))

    fig, axs = plt.subplots(1, 2, figsize=(16.0, 8.0))

    axs[0].pie(status_counts, autopct=lambda p: '{0:.1f}% ({1:})'. format(p, int(p * sum(status_counts) / 100)), 
               labels=status_counts.index, colors=colors)
    
    axs[1].pie(status_counts_17, autopct=lambda p: '{0:.1f}% ({1:})'. format(p, int(p * sum(status_counts_17) / 100)), 
               labels=status_counts_17.index, colors=colors)
    
    
    fig.suptitle("{}".format(county))
    plt.show()

i = interact(by_county_with_0to17, county=list(df['Hospital County'].dropna().unique()))



In [17]:
df.groupby('Admit Day of Week').size().plot(kind="bar", figsize=(16.0, 10.0), grid=False, colormap=plt.cm.summer)


Out[17]:
<matplotlib.axes.AxesSubplot at 0xfb23f50>

In [46]:
df.groupby(['Admit Day of Week', 'Type of Admission']).size().unstack('Type of Admission').plot(kind="bar", 
                                                                       figsize=(16.0, 10.0), 
                                                                       grid=False, 
                                                                       colormap=plt.cm.summer)


Out[46]:
<matplotlib.axes.AxesSubplot at 0xc45c3d0>

In [47]:
big_df = df[df["Total Charges"] >= 1000000]

In [20]:
list(big_df.columns)


Out[20]:
['Hospital Service Area',
 'Hospital County',
 'Operating Certificate Number',
 'Permanent Facility Id',
 'Facility Name',
 'Age Group',
 'Zip Code - 3 digits',
 'Gender',
 'Race',
 'Ethnicity',
 'Length of Stay',
 'Admit Day of Week',
 'Type of Admission',
 'Patient Disposition',
 'Discharge Year',
 'Discharge Day of Week',
 'CCS Diagnosis Code',
 'CCS Diagnosis Description',
 'CCS Procedure Code',
 'CCS Procedure Description',
 'APR DRG Code',
 'APR DRG Description',
 'APR MDC Code',
 'APR MDC Description',
 'APR Severity of Illness Code',
 'APR Severity of Illness Descript',
 'APR Risk of Mortality',
 'APR Medical Surgical Description',
 'Source of Payment 1',
 'Source of Payment 2',
 'Source of Payment 3',
 'Attending Provider License Numbe',
 'Operating Provider License Numbe',
 'Other Provider License Number',
 'Birth Weight',
 'Abortion Edit Indicator',
 'Emergency Department Indicator',
 'Total Charges']

In [48]:
big_df[big_df['Age Group'] == '0 to 17'].groupby(['Hospital County', 'Facility Name']).size()


Out[48]:
Hospital County  Facility Name                                                       
Albany           Albany Medical Center Hospital                                            8
Bronx            Montefiore Med Center - Jack D Weiler Hosp of A Einstein College Div     34
                 Montefiore Medical Center - Henry & Lucy Moses Div                       19
                 Montefiore Medical Center - North Division                               10
Erie             Women And Children's Hospital Of Buffalo                                 18
Kings            Maimonides Medical Center                                                24
                 New York Methodist Hospital                                               1
                 University Hospital of Brooklyn                                           1
Manhattan        Beth Israel Medical Center/Petrie Campus                                  1
                 Lenox Hill Hospital                                                       4
                 Memorial Hospital for Cancer and Allied Diseases                          4
                 Mount Sinai Hospital                                                     11
                 NYU Hospitals Center                                                     14
                 New York Presbyterian Hospital - Allen Hospital                           2
                 New York Presbyterian Hospital - Columbia Presbyterian Center           104
                 New York Presbyterian Hospital - New York Weill Cornell Center           40
                 St Lukes Roosevelt Hospital Center - Roosevelt Hospital Division          2
Monroe           Strong Memorial Hospital                                                  4
Nassau           North Shore University Hospital                                          17
                 Winthrop-University Hospital                                              6
Queens           Long Island Jewish Schneiders Children's Hospital Division               45
Richmond         Richmond University Medical Center                                        1
Suffolk          University Hospital                                                       7
Westchester      Blythedale Childrens Hospital                                            11
                 Westchester Medical Center                                               96
dtype: int64

In [22]:
len(big_df[big_df['Age Group'] == '0 to 17']) / float(len(big_df))


Out[22]:
0.39445802770986144

In [23]:
len(df[df['Age Group'] == '0 to 17']) / float(len(df))


Out[23]:
0.14721347406640728

In [24]:
pd.set_option('display.max_columns', None)
big_df[big_df['Age Group'] == '0 to 17']


Out[24]:
Hospital Service Area Hospital County Operating Certificate Number Permanent Facility Id Facility Name Age Group Zip Code - 3 digits Gender Race Ethnicity Length of Stay Admit Day of Week Type of Admission Patient Disposition Discharge Year Discharge Day of Week CCS Diagnosis Code CCS Diagnosis Description CCS Procedure Code CCS Procedure Description APR DRG Code APR DRG Description APR MDC Code APR MDC Description APR Severity of Illness Code APR Severity of Illness Descript APR Risk of Mortality APR Medical Surgical Description Source of Payment 1 Source of Payment 2 Source of Payment 3 Attending Provider License Numbe Operating Provider License Numbe Other Provider License Number Birth Weight Abortion Edit Indicator Emergency Department Indicator Total Charges
43887 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 140 F White Not Span/Hispanic 120 + MON Urgent Home or Self Care 2012 WED 217 OTH CONGENTL ANOMALY 34 TRACHEOSTOMY; TEMP/PERM 4 TRACHEOSTOMY W MV 96+ HOURS W EXTENSIVE PROCED... 3 Ear, Nose, Mouth, Throat and Craniofacial Dise... 4 Extreme Extreme Surgical Blue Cross Medicaid Self-Pay 223318 168257 197068 0 N N 1424637.98
43888 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 142 M White Not Span/Hispanic 120 + TUE Urgent Expired 2012 WED 221 RESP DISTRSS SYNDROME 231 OTHER THERAPEUTIC PRCS 591 NEONATE BIRTHWT 500-749G W/O MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Medical Insurance Company Insurance Company Self-Pay 3058 3058 197068 700 N N 2248980.53
43889 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 142 M Black/African American Not Span/Hispanic 120 + FRI Newborn Home w/ Home Health Services 2012 THU 218 LIVEBORN 2 IRR XCRANIAL VENT SHUNT 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Surgical Medicaid Self-Pay NaN 190900 193028 176099 500 N N 1384761.45
43890 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 142 M Black/African American Not Span/Hispanic 120 + TUE Urgent Home or Self Care 2012 TUE 134 OTHR UPPR RESP DISEASE 34 TRACHEOSTOMY; TEMP/PERM 4 TRACHEOSTOMY W MV 96+ HOURS W EXTENSIVE PROCED... 3 Ear, Nose, Mouth, Throat and Craniofacial Dise... 4 Extreme Major Surgical Medicaid Self-Pay NaN 190900 190044 168257 0 N N 1343179.07
43894 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 141 M White Not Span/Hispanic 120 + WED Urgent Home or Self Care 2012 WED 221 RESP DISTRSS SYNDROME 61 OT OR PRCS VES NOT HEAD 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Surgical Medicaid Self-Pay NaN 223318 258238 258238 500 N Y 1773112.63
44173 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 142 M Other Race Not Span/Hispanic 120 + WED Urgent Home w/ Home Health Services 2012 MON 219 SHORT GEST/LOW BRTHWT 75 SMALL BOWEL RESECTON 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Surgical Insurance Company Self-Pay NaN 134158 258238 NaN 400 N N 1039252.13
44403 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 140 M White Not Span/Hispanic 120 + FRI Urgent Home w/ Home Health Services 2012 THU 221 RESP DISTRSS SYNDROME 75 SMALL BOWEL RESECTON 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Surgical Insurance Company Self-Pay NaN 190900 40003893 NaN 700 N N 1028649.45
44939 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 142 M Black/African American Not Span/Hispanic 120 + THU Emergency Skilled Nursing Home 2012 FRI 2 SEPTICEMIA 75 SMALL BOWEL RESECTON 710 INFECTIOUS & PARASITIC DISEASES INCLUDING HIV ... 18 Infectious and Parasitic Diseases, Systemic or... 4 Extreme Extreme Surgical Medicaid Self-Pay NaN 234656 40003893 40003893 0 N Y 1237143.56
44940 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 142 F White Not Span/Hispanic 120 + SUN Newborn Expired 2012 WED 218 LIVEBORN 216 RESP INTUB/MECH VENTIL 593 NEONATE BIRTHWT 750-999G W/O MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Medical Medicaid Self-Pay NaN 190900 190900 258436 800 N N 1019454.93
46261 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 142 M Black/African American Not Span/Hispanic 66 TUE Newborn Expired 2012 FRI 218 LIVEBORN 216 RESP INTUB/MECH VENTIL 593 NEONATE BIRTHWT 750-999G W/O MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Medical Medicaid Insurance Company Self-Pay 174590 174590 258238 700 N Y 1004017.20
47048 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 142 M Black/African American Not Span/Hispanic 65 MON Urgent Expired 2012 WED 237 DEVICE/IMPLNT/GRFT COMP 216 RESP INTUB/MECH VENTIL 721 POST-OPERATIVE, POST-TRAUMATIC, OTHER DEVICE I... 18 Infectious and Parasitic Diseases, Systemic or... 4 Extreme Extreme Medical Medicaid Self-Pay NaN 208947 208947 201204 0 N Y 1003374.01
47484 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 142 M White Not Span/Hispanic 120 + FRI Newborn Expired 2012 WED 218 LIVEBORN 61 OT OR PRCS VES NOT HEAD 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Surgical Medicaid Self-Pay NaN 208947 258238 NaN 700 N N 2019851.97
47938 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 142 M Black/African American Not Span/Hispanic 120 + FRI Newborn Home w/ Home Health Services 2012 MON 218 LIVEBORN 94 OT OR UP GI THER PRCS 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Surgical Medicaid Self-Pay NaN 244296 258238 199415 700 N N 1111026.97
48427 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 141 F Other Race Not Span/Hispanic 120 + FRI Newborn Home w/ Home Health Services 2012 THU 218 LIVEBORN 216 RESP INTUB/MECH VENTIL 589 NEONATE BWT <500G 15 Newborns and Other Neonates with Conditions Or... 3 Major Major Medical Insurance Company Self-Pay NaN 259430 259430 NaN 400 N N 1291191.94
48930 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 142 F Black/African American Not Span/Hispanic 120 + MON Newborn Home w/ Home Health Services 2012 SAT 218 LIVEBORN 99 OT OR GI THER PRCS 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Surgical Medicaid Insurance Company Self-Pay 174590 40003893 NaN 600 N N 1187951.82
51297 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 142 F Black/African American Not Span/Hispanic 120 + SAT Newborn Home w/ Home Health Services 2012 FRI 218 LIVEBORN 75 SMALL BOWEL RESECTON 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Surgical Medicaid Self-Pay NaN 223708 40003893 NaN 600 N N 1213370.84
54530 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 143 M Other Race Not Span/Hispanic 19 THU Emergency Home w/ Home Health Services 2012 TUE 234 CRUSH/INTERNAL INJURY 100 ENDOSCOPY URINARY TRACT 468 OTHER KIDNEY & URINARY TRACT DIAGNOSES, SIGNS ... 11 Diseases and Disorders of the Kidney and Urina... 4 Extreme Moderate Medical Insurance Company Self-Pay NaN 230423 231942 NaN 0 N Y 1804076.41
56012 Western NY Erie 1401014 208 Women And Children's Hospital Of Buffalo 0 to 17 142 M Black/African American Not Span/Hispanic 48 MON Newborn Expired 2012 SUN 218 LIVEBORN 50 EXTRA CIRC AUX OPEN HRT 583 NEONATE W ECMO 15 Newborns and Other Neonates with Conditions Or... 3 Major Extreme Surgical Insurance Company Self-Pay NaN 40002564 40003893 NaN 3100 N N 1395058.67
250387 Finger Lakes Monroe 2701005 413 Strong Memorial Hospital 0 to 17 146 F Black/African American Not Span/Hispanic 120 + FRI Newborn Home w/ Home Health Services 2012 WED 218 LIVEBORN 223 ENTERAL/PARENTERAL NUTR 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Surgical Medicaid Self-Pay NaN 249611 243949 NaN 500 N N 1251280.78
250516 Finger Lakes Monroe 2701005 413 Strong Memorial Hospital 0 to 17 145 M Black/African American Not Span/Hispanic 120 + WED Emergency Skilled Nursing Home 2012 WED 233 INTRACRANIAL INJURY 34 TRACHEOSTOMY; TEMP/PERM 4 TRACHEOSTOMY W MV 96+ HOURS W EXTENSIVE PROCED... 1 Diseases and Disorders of the Nervous System 4 Extreme Extreme Surgical Blue Cross Insurance Company NaN 124938 217266 NaN 0 N Y 1331683.89
259376 Finger Lakes Monroe 2701005 413 Strong Memorial Hospital 0 to 17 145 F White Not Span/Hispanic 120 + MON Elective Expired 2012 SAT 96 HEART VALVE DISORDER 50 EXTRA CIRC AUX OPEN HRT 4 TRACHEOSTOMY W MV 96+ HOURS W EXTENSIVE PROCED... 5 Diseases and Disorders of the Circulatory System 4 Extreme Major Surgical Medicaid Medicaid NaN 176297 176297 NaN 0 N N 1280123.47
265413 Finger Lakes Monroe 2701005 413 Strong Memorial Hospital 0 to 17 146 F Other Race Spanish/Hispanic 120 + TUE Newborn Home or Self Care 2012 WED 218 LIVEBORN 216 RESP INTUB/MECH VENTIL 591 NEONATE BIRTHWT 500-749G W/O MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Medical Medicaid Medicaid NaN 124938 185671 NaN 600 N N 1019773.45
539517 Capital/Adiron Albany 101000 1 Albany Medical Center Hospital 0 to 17 128 M White Not Span/Hispanic 120 + FRI Newborn Home w/ Home Health Services 2012 SAT 218 LIVEBORN 61 OT OR PRCS VES NOT HEAD 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Surgical Insurance Company Medicaid Self-Pay 176730 218128 119640 500 N N 1293614.94
540260 Capital/Adiron Albany 101000 1 Albany Medical Center Hospital 0 to 17 123 F Black/African American Not Span/Hispanic 120 + WED Newborn Home w/ Home Health Services 2012 WED 218 LIVEBORN 61 OT OR PRCS VES NOT HEAD 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Surgical Medicaid Self-Pay NaN 176730 218128 143963 500 N N 1047946.77
540261 Capital/Adiron Albany 101000 1 Albany Medical Center Hospital 0 to 17 120 M Black/African American Not Span/Hispanic 120 + WED Newborn Home w/ Home Health Services 2012 MON 218 LIVEBORN 61 OT OR PRCS VES NOT HEAD 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Surgical Medicaid Self-Pay NaN 176730 218128 143963 500 N N 1075733.71
542229 Capital/Adiron Albany 101000 1 Albany Medical Center Hospital 0 to 17 124 M Other Race Not Span/Hispanic 120 + TUE Newborn Expired 2012 TUE 218 LIVEBORN 2 IRR XCRANIAL VENT SHUNT 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Surgical Medicaid Self-Pay NaN 213633 252663 149551 800 N N 1157588.75
542940 Capital/Adiron Albany 101000 1 Albany Medical Center Hospital 0 to 17 123 M Black/African American Not Span/Hispanic 120 + FRI Newborn Home w/ Home Health Services 2012 WED 218 LIVEBORN 216 RESP INTUB/MECH VENTIL 591 NEONATE BIRTHWT 500-749G W/O MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Moderate Medical Insurance Company Insurance Company Medicaid 176730 164357 119640 600 N N 1021771.78
545052 Capital/Adiron Albany 101000 1 Albany Medical Center Hospital 0 to 17 123 M White Not Span/Hispanic 120 + TUE Urgent Home w/ Home Health Services 2012 FRI 219 SHORT GEST/LOW BRTHWT 73 ILEO- & OT ENTER-OSTOMY 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Surgical Medicaid Self-Pay NaN 174586 223982 NaN 800 N N 1127563.10
545566 Capital/Adiron Albany 101000 1 Albany Medical Center Hospital 0 to 17 127 F White Not Span/Hispanic 120 + MON Newborn Home w/ Home Health Services 2012 WED 218 LIVEBORN 61 OT OR PRCS VES NOT HEAD 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Surgical Medicaid Self-Pay NaN 165423 218128 NaN 400 N N 1093849.87
546130 Capital/Adiron Albany 101000 1 Albany Medical Center Hospital 0 to 17 128 M White Not Span/Hispanic 120 + SUN Newborn Home w/ Home Health Services 2012 MON 218 LIVEBORN 216 RESP INTUB/MECH VENTIL 593 NEONATE BIRTHWT 750-999G W/O MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Moderate Medical Insurance Company Medicaid Self-Pay 194643 194643 NaN 800 N N 1069187.47
948975 Hudson Valley Westchester 5957000 1138 Blythedale Childrens Hospital 0 to 17 100 F White Not Span/Hispanic 120 + THU Elective Skilled Nursing Home 2012 WED 131 ADULT RESPIRTRY FAILURE 216 RESP INTUB/MECH VENTIL 130 RESPIRATORY SYSTEM DIAGNOSIS W VENTILATOR SUPP... 4 Diseases and Disorders of the Respiratory System 3 Major Minor Medical Blue Cross Medicaid NaN 233123 233123 NaN 0 N N 3947940.20
948976 Hudson Valley Westchester 5957000 1138 Blythedale Childrens Hospital 0 to 17 126 F Other Race Not Span/Hispanic 120 + FRI Elective Short-term Hospital 2012 FRI 131 ADULT RESPIRTRY FAILURE 216 RESP INTUB/MECH VENTIL 130 RESPIRATORY SYSTEM DIAGNOSIS W VENTILATOR SUPP... 4 Diseases and Disorders of the Respiratory System 3 Major Minor Medical Medicaid NaN NaN 161488 161488 NaN 0 N N 1314818.66
948977 Hudson Valley Westchester 5957000 1138 Blythedale Childrens Hospital 0 to 17 104 F Black/African American Not Span/Hispanic 120 + THU Elective Skilled Nursing Home 2012 MON 224 OTHER PERINATAL COND 216 RESP INTUB/MECH VENTIL 130 RESPIRATORY SYSTEM DIAGNOSIS W VENTILATOR SUPP... 4 Diseases and Disorders of the Respiratory System 3 Major Major Medical Medicaid NaN NaN 161488 161488 NaN 0 N N 1556554.77
948978 Hudson Valley Westchester 5957000 1138 Blythedale Childrens Hospital 0 to 17 105 M Other Race Spanish/Hispanic 120 + THU Elective Home w/ Home Health Services 2012 WED 131 ADULT RESPIRTRY FAILURE 216 RESP INTUB/MECH VENTIL 130 RESPIRATORY SYSTEM DIAGNOSIS W VENTILATOR SUPP... 4 Diseases and Disorders of the Respiratory System 3 Major Minor Medical Medicaid NaN NaN 161488 161488 NaN 0 N N 1113216.42
948979 Hudson Valley Westchester 5957000 1138 Blythedale Childrens Hospital 0 to 17 100 F White Not Span/Hispanic 120 + MON Elective Skilled Nursing Home 2012 WED 131 ADULT RESPIRTRY FAILURE 216 RESP INTUB/MECH VENTIL 130 RESPIRATORY SYSTEM DIAGNOSIS W VENTILATOR SUPP... 4 Diseases and Disorders of the Respiratory System 3 Major Minor Medical Medicaid NaN NaN 233123 233123 NaN 0 N N 1027327.09
948981 Hudson Valley Westchester 5957000 1138 Blythedale Childrens Hospital 0 to 17 100 F Other Race Unknown 120 + FRI Elective Home or Self Care 2012 MON 254 REHAB/PROSTH FIT/ADJUST 213 PHYS THER EXER, MANIPUL 860 REHABILITATION 23 Rehabilitation, Aftercare, Other Factors Influ... 3 Major Moderate Medical Medicaid NaN NaN 161488 161488 NaN 0 N N 1547643.18
948983 Hudson Valley Westchester 5957000 1138 Blythedale Childrens Hospital 0 to 17 110 M Black/African American Not Span/Hispanic 120 + WED Elective Short-term Hospital 2012 THU 131 ADULT RESPIRTRY FAILURE 216 RESP INTUB/MECH VENTIL 130 RESPIRATORY SYSTEM DIAGNOSIS W VENTILATOR SUPP... 4 Diseases and Disorders of the Respiratory System 3 Major Moderate Medical Medicaid NaN NaN 161488 161488 NaN 0 N N 1049882.09
948995 Hudson Valley Westchester 5957000 1138 Blythedale Childrens Hospital 0 to 17 112 M Other Race Unknown 120 + THU Elective Skilled Nursing Home 2012 THU 131 ADULT RESPIRTRY FAILURE 216 RESP INTUB/MECH VENTIL 130 RESPIRATORY SYSTEM DIAGNOSIS W VENTILATOR SUPP... 4 Diseases and Disorders of the Respiratory System 3 Major Minor Medical Medicaid NaN NaN 161488 161488 NaN 0 N N 1296953.50
949057 Hudson Valley Westchester 5957000 1138 Blythedale Childrens Hospital 0 to 17 112 M Other Race Unknown 120 + THU Elective Skilled Nursing Home 2012 WED 131 ADULT RESPIRTRY FAILURE 216 RESP INTUB/MECH VENTIL 130 RESPIRATORY SYSTEM DIAGNOSIS W VENTILATOR SUPP... 4 Diseases and Disorders of the Respiratory System 3 Major Minor Medical Blue Cross Medicaid NaN 161488 161488 NaN 0 N N 1059832.96
949097 Hudson Valley Westchester 5957000 1138 Blythedale Childrens Hospital 0 to 17 104 M Other Race Spanish/Hispanic 120 + TUE Elective Home w/ Home Health Services 2012 THU 131 ADULT RESPIRTRY FAILURE 216 RESP INTUB/MECH VENTIL 130 RESPIRATORY SYSTEM DIAGNOSIS W VENTILATOR SUPP... 4 Diseases and Disorders of the Respiratory System 3 Major Minor Medical Medicaid NaN NaN 161488 161488 NaN 0 N N 1050970.20
949117 Hudson Valley Westchester 5957000 1138 Blythedale Childrens Hospital 0 to 17 125 F Black/African American Not Span/Hispanic 120 + FRI Elective Home w/ Home Health Services 2012 MON 131 ADULT RESPIRTRY FAILURE 216 RESP INTUB/MECH VENTIL 130 RESPIRATORY SYSTEM DIAGNOSIS W VENTILATOR SUPP... 4 Diseases and Disorders of the Respiratory System 3 Major Moderate Medical Medicaid NaN NaN 161488 161488 NaN 0 N N 1052533.02
949514 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 107 F Black/African American Not Span/Hispanic 120 + THU Emergency Cancer Center or Children's Hospital 2012 THU 215 GU CONGENITAL ANOMALY 99 OT OR GI THER PRCS 447 OTHER KIDNEY, URINARY TRACT & RELATED PROCEDURES 11 Diseases and Disorders of the Kidney and Urina... 4 Extreme Major Surgical Medicaid NaN NaN 213692 190548 NaN 0 N N 3760584.17
949518 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 105 M Black/African American Not Span/Hispanic 120 + TUE Emergency Home or Self Care 2012 WED 39 LEUKEMIAS 64 BONE MARROW TRANSPLANT 3 BONE MARROW TRANSPLANT 17 Lymphatic, Hematopoietic, Other Malignancies, ... 4 Extreme Extreme Surgical Insurance Company Medicaid NaN 195800 195800 NaN 0 N Y 2096066.41
949520 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 126 F White Spanish/Hispanic 120 + WED Newborn Home w/ Home Health Services 2012 FRI 224 OTHER PERINATAL COND 75 SMALL BOWEL RESECTON 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Surgical Medicaid NaN NaN 172123 190548 NaN 600 N N 2504247.34
949524 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 107 M Other Race Spanish/Hispanic 120 + SUN Newborn Home or Self Care 2012 FRI 218 LIVEBORN 90 EXCISION; LYS PERI ADHS 609 NEONATE BWT 1500-2499G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Surgical Medicaid NaN NaN 240081 222845 NaN 2100 N N 2347608.89
949527 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 105 F Black/African American Not Span/Hispanic 120 + WED Newborn Home or Self Care 2012 THU 218 LIVEBORN 94 OT OR UP GI THER PRCS 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Surgical Medicaid NaN NaN 225261 262191 NaN 500 N N 4971830.83
949528 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 105 M Black/African American Not Span/Hispanic 120 + TUE Emergency Expired 2012 WED 41 OTHER PRIMARY CANCER 64 BONE MARROW TRANSPLANT 3 BONE MARROW TRANSPLANT 1 Diseases and Disorders of the Nervous System 3 Major Extreme Surgical Medicaid NaN NaN 195800 195800 NaN 0 N Y 1924268.99
949532 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 109 M Other Race Spanish/Hispanic 120 + TUE Newborn Cancer Center or Children's Hospital 2012 WED 218 LIVEBORN 94 OT OR UP GI THER PRCS 609 NEONATE BWT 1500-2499G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Surgical Medicaid NaN NaN 230008 262191 NaN 2400 N N 3975797.52
949579 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 109 M White Not Span/Hispanic 44 TUE Emergency Cancer Center or Children's Hospital 2012 THU 233 INTRACRANIAL INJURY 9 OTHER OR THER NERV SYS 4 TRACHEOSTOMY W MV 96+ HOURS W EXTENSIVE PROCED... 1 Diseases and Disorders of the Nervous System 4 Extreme Major Surgical Insurance Company Medicaid NaN 206893 240876 NaN 0 N Y 1183552.17
950433 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 109 M Other Race Spanish/Hispanic 120 + THU Newborn Cancer Center or Children's Hospital 2012 WED 219 SHORT GEST/LOW BRTHWT 2 IRR XCRANIAL VENT SHUNT 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Surgical Insurance Company Medicaid NaN 220406 249950 NaN 500 N N 2109760.43
950435 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 104 M Other Race Spanish/Hispanic 108 SAT Newborn Home w/ Home Health Services 2012 TUE 218 LIVEBORN 54 OT VASC CATH; NOT HEART 591 NEONATE BIRTHWT 500-749G W/O MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Medical Blue Cross Self-Pay NaN 240081 240081 NaN 600 N N 1554080.46
950436 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 104 M Other Race Not Span/Hispanic 92 SAT Newborn Home or Self Care 2012 SUN 218 LIVEBORN 216 RESP INTUB/MECH VENTIL 593 NEONATE BIRTHWT 750-999G W/O MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Moderate Medical Blue Cross Medicaid NaN 225261 225261 NaN 800 N N 1202932.78
950437 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 104 F Other Race Not Span/Hispanic 86 SAT Newborn Home w/ Home Health Services 2012 MON 218 LIVEBORN 216 RESP INTUB/MECH VENTIL 593 NEONATE BIRTHWT 750-999G W/O MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Moderate Medical Blue Cross Medicaid NaN 225261 225261 NaN 800 N N 1089075.92
950440 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 109 F White Not Span/Hispanic 84 WED Newborn Home or Self Care 2012 WED 218 LIVEBORN 216 RESP INTUB/MECH VENTIL 591 NEONATE BIRTHWT 500-749G W/O MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Medical Insurance Company NaN NaN 240081 240081 NaN 600 N N 1169894.05
950441 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 105 F Black/African American Not Span/Hispanic 100 SUN Newborn Home w/ Home Health Services 2012 TUE 218 LIVEBORN 61 OT OR PRCS VES NOT HEAD 588 NEONATE BWT <1500G W MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Surgical Medicaid NaN NaN 219316 252782 NaN 400 N N 1489666.09
950444 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 107 F Other Race Spanish/Hispanic 75 TUE Newborn Expired 2012 SUN 218 LIVEBORN 216 RESP INTUB/MECH VENTIL 591 NEONATE BIRTHWT 500-749G W/O MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Medical Medicaid NaN NaN 131116 131116 NaN 500 N N 1209346.42
950445 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 105 M Black/African American Not Span/Hispanic 120 + WED Newborn Home w/ Home Health Services 2012 TUE 218 LIVEBORN 99 OT OR GI THER PRCS 631 NEONATE BIRTHWT >2499G W OTHER MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Surgical Medicaid NaN NaN 172123 222845 NaN 3300 N N 1971527.03
950449 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 125 M White Not Span/Hispanic 102 SAT Emergency Home or Self Care 2012 WED 59 ANEMIA 223 ENTERAL/PARENTERAL NUTR 660 MAJOR HEMATOLOGIC/IMMUNOLOGIC DIAG EXC SICKLE ... 16 Diseases and Disorders of Blood, Blood Forming... 4 Extreme Moderate Medical Insurance Company Medicaid NaN 168954 168954 NaN 0 N Y 1139684.48
950450 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 107 F White Not Span/Hispanic 75 SUN Newborn Cancer Center or Children's Hospital 2012 FRI 218 LIVEBORN 54 OT VASC CATH; NOT HEART 591 NEONATE BIRTHWT 500-749G W/O MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Major Medical Medicaid NaN NaN 220406 220406 NaN 600 N N 1078048.95
950451 Hudson Valley Westchester 5957001 1139 Westchester Medical Center 0 to 17 107 M White Not Span/Hispanic 75 SUN Newborn Cancer Center or Children's Hospital 2012 FRI 218 LIVEBORN 216 RESP INTUB/MECH VENTIL 593 NEONATE BIRTHWT 750-999G W/O MAJOR PROCEDURE 15 Newborns and Other Neonates with Conditions Or... 4 Extreme Extreme Medical Medicaid NaN NaN 220406 220406 NaN 700 N N 1123999.27
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...

484 rows × 38 columns


In [25]:
big_df.groupby('APR Medical Surgical Description').size()


Out[25]:
APR Medical Surgical Description
Medical                             361
Not Applicable                        2
Surgical                            864
dtype: int64

In [26]:
big_young_df = big_df[big_df['Age Group'] == '0 to 17']

In [27]:
list(big_young_df.columns)


Out[27]:
['Hospital Service Area',
 'Hospital County',
 'Operating Certificate Number',
 'Permanent Facility Id',
 'Facility Name',
 'Age Group',
 'Zip Code - 3 digits',
 'Gender',
 'Race',
 'Ethnicity',
 'Length of Stay',
 'Admit Day of Week',
 'Type of Admission',
 'Patient Disposition',
 'Discharge Year',
 'Discharge Day of Week',
 'CCS Diagnosis Code',
 'CCS Diagnosis Description',
 'CCS Procedure Code',
 'CCS Procedure Description',
 'APR DRG Code',
 'APR DRG Description',
 'APR MDC Code',
 'APR MDC Description',
 'APR Severity of Illness Code',
 'APR Severity of Illness Descript',
 'APR Risk of Mortality',
 'APR Medical Surgical Description',
 'Source of Payment 1',
 'Source of Payment 2',
 'Source of Payment 3',
 'Attending Provider License Numbe',
 'Operating Provider License Numbe',
 'Other Provider License Number',
 'Birth Weight',
 'Abortion Edit Indicator',
 'Emergency Department Indicator',
 'Total Charges']

In [52]:
big_young_df.groupby('CCS Diagnosis Description').size()


Out[52]:
CCS Diagnosis Description
ADULT RESPIRTRY FAILURE       19
ANEMIA                         2
BILIARY TRACT DISEASE          1
BIRTH ASPHYXIA                 1
BONE/CONN TISSU CANCER         1
BRAIN/NERV SYST CANCER         2
BURNS                          2
CARDIO/CIRC CONG ANMLY        30
CARDITIS/CARDIOMYOPTHY         1
CHEMO/RADIATN THERAPY          1
CHF                            5
CRUSH/INTERNAL INJURY          1
DEVICE/IMPLNT/GRFT COMP       10
DIABETES W/COMPL               1
ENCEPHALITIS                   1
EPILEPSY/CONVULSIONS           5
GASTRODUODENAL ULCER           1
GI CONGENITAL ANOMALY          3
GU CONGENITAL ANOMALY          1
HEART VALVE DISORDER           1
IMMUNITY DISORDER              3
INTESTINAL INFECTION           1
INTRACRANIAL INJURY            4
LEUKEMIAS                      6
LIVEBORN                     288
NAUSEA/VOMITING                1
NERVS SYS CONG ANOMLY          2
OTH COMP BIRTH/PUERPRM         1
OTH CONGENTL ANOMALY           5
OTHER INJURY/COND              1
OTHER PERINATAL COND          10
OTHER PRIMARY CANCER           3
OTHR NUTRITION DISORDER        1
OTHR UPPR RESP DISEASE         3
OTHR UPPR RESP INFECTN         2
PANCREAS DISORDER              1
PERIPH/VSCRL ATHRSCLRS         2
PNEUMONIA                      4
REHAB/PROSTH FIT/ADJUST        1
RESP DISTRSS SYNDROME         17
SEPTICEMIA                    13
SHORT GEST/LOW BRTHWT         20
SKULL/FACE FRACTURE            1
SURGCL/MED CARE COMPL          1
WHITE BLOODCELL DISEASE        4
dtype: int64

In [58]:
big_young_df.groupby(["CCS Diagnosis Description", "Patient Disposition"]).size()


Out[58]:
CCS Diagnosis Description  Patient Disposition                 
ADULT RESPIRTRY FAILURE    Cancer Center or Children's Hospital     4
                           Expired                                  4
                           Home or Self Care                        1
                           Home w/ Home Health Services             3
                           Short-term Hospital                      2
                           Skilled Nursing Home                     5
ANEMIA                     Home or Self Care                        2
BILIARY TRACT DISEASE      Home w/ Home Health Services             1
BIRTH ASPHYXIA             Home w/ Home Health Services             1
BONE/CONN TISSU CANCER     Home or Self Care                        1
BRAIN/NERV SYST CANCER     Cancer Center or Children's Hospital     1
                           Expired                                  1
BURNS                      Cancer Center or Children's Hospital     1
                           Expired                                  1
CARDIO/CIRC CONG ANMLY     Cancer Center or Children's Hospital    10
...
RESP DISTRSS SYNDROME      Home w/ Home Health Services             7
SEPTICEMIA                 Cancer Center or Children's Hospital     2
                           Expired                                  2
                           Home or Self Care                        2
                           Home w/ Home Health Services             5
                           Skilled Nursing Home                     2
SHORT GEST/LOW BRTHWT      Cancer Center or Children's Hospital     2
                           Home or Self Care                        5
                           Home w/ Home Health Services            12
                           Skilled Nursing Home                     1
SKULL/FACE FRACTURE        Home or Self Care                        1
SURGCL/MED CARE COMPL      Home w/ Home Health Services             1
WHITE BLOODCELL DISEASE    Expired                                  2
                           Home or Self Care                        1
                           Home w/ Home Health Services             1
Length: 106, dtype: int64

Patient Disposition Frequency Distribution

Give an explination here


In [54]:
big_young_df.groupby('Patient Disposition').size()


Out[54]:
Patient Disposition
Another Type Not Listed                   1
Cancer Center or Children's Hospital     77
Expired                                  48
Home or Self Care                       130
Home w/ Home Health Services            166
Inpatient Rehabilitation Facility        10
Short-term Hospital                      33
Skilled Nursing Home                     19
dtype: int64

In [62]:
pd.
big_young_df['Length of Stay']


Out[62]:
43887    120 +
43888    120 +
43889    120 +
43890    120 +
43894    120 +
44173    120 +
44403    120 +
44939    120 +
44940    120 +
46261       66
47048       65
47484    120 +
47938    120 +
48427    120 +
48930    120 +
...
2305767    120 +
2305768      108
2305773      104
2305776      104
2305782      109
2305841    120 +
2310693    120 +
2312079    120 +
2322018       98
2322521      119
2332046       76
2339357       95
2339360       90
2339899      104
2343601       88
Name: Length of Stay, Length: 484, dtype: object