The National Alliance of Concurrent Enrollment Partnerships

2015-16 Civil Rights Data Collection (CRDC)

Advanced Placement (AP) v. Dual Enrollment (DE)

Breaking Down all High Schools Based on AP/DE Offering Status (DE-Only, AP-Only, Both, Neither)

Alijah O'Connor - 2018



For a more detailed look into the state of AP and DE offering (as well as total enrollments) in 2015-2016, the filtered high schools (for more details, see intital filtration methodology) can be broken down into four categories based on whether they only offer DE, only AP, Both, or Neither. The results are broken down herein in the follow ways:

- Nationally
    - Schools
    - Enrollments
- By School 9-12th Grade Enrollment
    - Schools
    - Enrollments
- By School Locale
    - Schools
    - Enrollments
- By School Non-White Student Percentage
    - Schools 
    - Enrollments
- By State
    - Schools
    - Enrollments
- By Region (Accreditation)
    - Schools
    - Enrollments
- By Region (Census)
    - Schools
    - Enrollments
- By Region (NACEP)
    - Schools
    - Enrollments


In [1]:
from IPython.display import HTML

HTML('''<script>
code_show=true; 
function code_toggle() {
 if (code_show){
 $('div.input').hide();
 } else {
 $('div.input').show();
 }
 code_show = !code_show
} 
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Click here to toggle on/off the raw code."></form>''')
Out[1]:
In [2]:
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt

import plotly.plotly as py
import plotly.graph_objs as go
from plotly.offline import init_notebook_mode,iplot
init_notebook_mode(connected = True)

%matplotlib inline
sns.set_style('whitegrid')
plt.rc('axes', titlesize = 14, titleweight = 'bold', labelweight = 'bold')
In [3]:
hs_uncleaned = pd.read_csv('../filtered_data/04_filter_final.csv', dtype = {'LEAID':np.object})

Set Up

In [4]:
from my_functions.extra_functions import hs_enrollment_averager, missing_value_mapper
hs = hs_uncleaned.copy()
hs = hs.applymap(missing_value_mapper)
hs['total_enrollment'] = hs['TOT_ENR_M'] + hs['TOT_ENR_F']
hs['hs_total_enrollment'] = hs_enrollment_averager(hs) 
In [5]:
def make_ap_only(ap_flag, de_flag):
    if ap_flag == 'Yes' and de_flag == 'No':
        return 1
    return 0

def make_de_only(ap_flag, de_flag):
    if ap_flag =='No' and de_flag == 'Yes':
        return 1
    return 0

def make_neither(ap_flag, de_flag):
    if ap_flag == 'No' and de_flag == 'No':
        return 1
    return 0

def make_both(ap_flag, de_flag):
    if ap_flag == 'Yes' and de_flag == 'Yes':
        return 1
    return 0
In [6]:
hs['AP Only'] = hs.apply(lambda row: make_ap_only(row['SCH_APENR_IND'],row['SCH_DUAL_IND']), axis=1)
hs['DE Only'] = hs.apply(lambda row: make_de_only(row['SCH_APENR_IND'],row['SCH_DUAL_IND']), axis=1)
hs['Neither AP DE'] = hs.apply(lambda row: make_neither(row['SCH_APENR_IND'],row['SCH_DUAL_IND']), axis=1)
hs['Both AP DE'] = hs.apply(lambda row: make_both(row['SCH_APENR_IND'],row['SCH_DUAL_IND']), axis=1)
In [7]:
"""Set up DataFrames for each combination of DE/AP"""
hs_AP_Only = hs.copy()
hs_AP_Only = hs_AP_Only[hs_AP_Only['AP Only'] == 1]

hs_de_only = hs.copy()
hs_de_only = hs_de_only[hs_de_only['DE Only'] == 1]

hs_Neither_AP_DE = hs.copy()
hs_Neither_AP_DE = hs_Neither_AP_DE[hs_Neither_AP_DE['Neither AP DE'] == 1]

hs_Both_AP_DE = hs.copy()
hs_Both_AP_DE = hs_Both_AP_DE[hs_Both_AP_DE['Both AP DE'] == 1]
In [8]:
"""Additional Helper Functions for Analyses Below"""
from my_functions.extra_functions import de_ap_enrollments, add_de_ap_pcts

Analysis


National

-- Schools

In [9]:
num_total_schools = len(hs)
num_de_only_schools = len(hs_de_only)
num_AP_Only_schools = len(hs_AP_Only)
num_both_schools = len(hs_Both_AP_DE)
num_neither_schools = len(hs_Neither_AP_DE)

national_school_breakdown = pd.DataFrame({'National': 
                                         [num_de_only_schools, num_AP_Only_schools,
                                          num_both_schools, num_neither_schools, num_total_schools]}, 
                                        index = ['DE Only', 'AP Only', 'Both AP DE', 'Neither AP DE', 'Total']).T

national_school_breakdown_with_pcts = add_de_ap_pcts(national_school_breakdown)
national_school_breakdown_with_pcts
Out[9]:
DE Only % DE-Only Schools in Group AP Only % AP-Only Schools in Group Neither AP DE % Neither Schools in Group Both AP DE % Both Schools in Group Total
National 3875 20.7 3301 17.7 2045 10.9 9463 50.6 18684
In [10]:
with plt.rc_context({'lines.linewidth': 5, 'font.weight':'bold'}):
    national_school_breakdown.T.drop('Total').plot.pie(y='National',autopct='%1.1f%%', 
                            startangle = -45, shadow = True, explode = [.05 for i in range(len(national_school_breakdown.T)-1)],
                            colormap='Paired', figsize = (5,5))
    plt.title('All HS by AP/DE Offering Status')
    plt.legend([])
    plt.ylabel('')
    plt.xticks(fontdict={'fontweight':'bold'})
    plt.axis('equal')

-- Enrollments

In [11]:
de_ap_enrollments(hs_de_only, hs_AP_Only, hs_Neither_AP_DE, hs_Both_AP_DE)
Out[11]:
HS Students in DE-Only Schools % DE-Only Schools HS Students in AP-Only Schools % AP-Only Schools HS Students in Schools w/ Neither % Neither Schools HS Students in Schools w/ Both % Both Schools Total
HS Enrollments 965321 6.9 3079276 21.9 411909 2.9 9620163 68.3 14076669

By School 9-12th Grade Enrollment

- Schools were grouped into four categories based on how many students were enrolled in grades 9-12 in each one:
    - <100
    - 100 - 499
    - 500 - 1199
    - 1200+
In [12]:
from my_functions.extra_functions import school_sizer
hs_AP_Only['size_group'] = hs_AP_Only['hs_total_enrollment'].apply(lambda x: school_sizer(x))
hs_de_only['size_group'] = hs_de_only['hs_total_enrollment'].apply(lambda x: school_sizer(x))
hs_Neither_AP_DE['size_group'] = hs_Neither_AP_DE['hs_total_enrollment'].apply(lambda x: school_sizer(x))
hs_Both_AP_DE['size_group'] = hs_Both_AP_DE['hs_total_enrollment'].apply(lambda x: school_sizer(x))
In [13]:
"""Set up Grouped DataFrames"""
hs_de_only_size = hs_de_only.groupby('size_group')['LEAID'].count()
hs_de_only_size.rename('DE Only', inplace=True);

hs_AP_Only_size = hs_AP_Only.groupby('size_group')['LEAID'].count()
hs_AP_Only_size.rename('AP Only', inplace=True);

hs_Neither_AP_DE_size = hs_Neither_AP_DE.groupby('size_group')['LEAID'].count()
hs_Neither_AP_DE_size.rename('Neither AP DE', inplace=True);

hs_Both_AP_DE_size = hs_Both_AP_DE.groupby('size_group')['LEAID'].count()
hs_Both_AP_DE_size.rename('Both AP DE', inplace=True);

-- Schools

In [14]:
by_size = pd.concat([hs_de_only_size, hs_AP_Only_size, hs_Neither_AP_DE_size, hs_Both_AP_DE_size], axis = 1)
by_size['Total'] = by_size['DE Only'] + by_size['AP Only'] + by_size['Both AP DE'] + by_size['Neither AP DE']
by_size = by_size.rename({1:'<100', 2:'100-499', 3:'500-1199', 4:'>1200'})

by_size = add_de_ap_pcts(by_size)
by_size.index.names = ['HS Student Enrollment']
by_size
Out[14]:
DE Only % DE-Only Schools in Group AP Only % AP-Only Schools in Group Neither AP DE % Neither Schools in Group Both AP DE % Both Schools in Group Total
HS Student Enrollment
<100 1122 47.5 124 5.3 906 38.4 209 8.9 2361
100-499 2316 31.3 1190 16.1 980 13.2 2913 39.4 7399
500-1199 375 8.2 1002 22.0 133 2.9 3038 66.8 4548
>1200 62 1.4 985 22.5 26 0.6 3303 75.5 4376

-- Enrollments

In [15]:
enrollments_by_size = de_ap_enrollments(hs_de_only, hs_AP_Only, hs_Neither_AP_DE, hs_Both_AP_DE, groupby_field = 'size_group')
enrollments_by_size = enrollments_by_size.rename({1:'<100', 2:'100-499', 3:'500-1199', 4:'>1200'})
enrollments_by_size.index.names = ['HS Student Enrollment']
enrollments_by_size
Out[15]:
HS Students in DE-Only Schools % DE-Only Schools HS Students in AP-Only Schools % AP-Only Schools HS Students in Schools w/ Neither % Neither Schools HS Students in Schools w/ Both % Both Schools Total
HS Student Enrollment
<100 68681 52.1 7855 6.0 41074 31.1 14325 10.9 131935
100-499 543212 26.7 370301 18.2 227635 11.2 890222 43.8 2031370
500-1199 255761 7.0 795319 21.8 95076 2.6 2495019 68.5 3641175
>1200 97667 1.2 1905801 23.0 48124 0.6 6220597 75.2 8272189

By School Locale

- Schools were grouped into four categories based on their locale (as defined by the NCES):
    - City: "Territory inside an Urbanized Area and inside a Principal City" 
    - Rural: "Census-defined rural territory"
    - Suburban: "Territory outside a Principal City and inside an Urbanized Area"
    - Town: "Territory inside an Urban Cluster"
In [16]:
locale_map = {11: 'City', 12: 'City', 13: 'City', 14: 'City',
              21: 'Suburban', 22: 'Suburban', 23: 'Suburban', 24: 'Suburban',
              31: 'Town', 32: 'Town', 33: 'Town', 34: 'Town',
              41: 'Rural', 42: 'Rural', 43: 'Rural', 44: 'Rural'}
In [17]:
hs_de_only['locale'] = hs_de_only['LOCALE15'].map(locale_map)
hs_AP_Only['locale'] = hs_AP_Only['LOCALE15'].map(locale_map)
hs_Neither_AP_DE['locale'] = hs_Neither_AP_DE['LOCALE15'].map(locale_map)
hs_Both_AP_DE['locale'] = hs_Both_AP_DE['LOCALE15'].map(locale_map)
In [18]:
"""Set up Grouped DataFrames"""
hs_de_only_locale = hs_de_only.groupby('locale')['LEAID'].count()
hs_de_only_locale.rename('DE Only', inplace=True);

hs_AP_Only_locale = hs_AP_Only.groupby('locale')['LEAID'].count()
hs_AP_Only_locale.rename('AP Only', inplace=True);

hs_Neither_AP_DE_locale = hs_AP_Only.groupby('locale')['LEAID'].count()
hs_Neither_AP_DE_locale.rename('Neither AP DE', inplace=True);

hs_Both_AP_DE_locale = hs_Both_AP_DE.groupby('locale')['LEAID'].count()
hs_Both_AP_DE_locale.rename('Both AP DE', inplace=True);

-- Schools

In [19]:
by_locale = pd.concat([hs_de_only_locale, hs_AP_Only_locale, hs_Neither_AP_DE_locale, hs_Both_AP_DE_locale], axis = 1)
by_locale['Total'] = by_locale['DE Only'] + by_locale['AP Only'] + by_locale['Both AP DE'] + by_locale['Neither AP DE']

by_locale = add_de_ap_pcts(by_locale)
by_locale.index.names = ['Locale']
by_locale
Out[19]:
DE Only % DE-Only Schools in Group AP Only % AP-Only Schools in Group Neither AP DE % Neither Schools in Group Both AP DE % Both Schools in Group Total
Locale
City 337 7.2 1187 25.4 1187 25.4 1968 42.1 4679
Rural 2718 37.5 693 9.6 693 9.6 3135 43.3 7239
Suburban 268 5.1 1068 20.3 1068 20.3 2861 54.3 5265
Town 552 20.0 353 12.8 353 12.8 1499 54.4 2757

-- Enrollments

In [20]:
locale_enrollments = de_ap_enrollments(hs_de_only, hs_AP_Only, 
                                       hs_Neither_AP_DE, hs_Both_AP_DE, groupby_field = 'locale')
locale_enrollments.index.names = ['Locale']
locale_enrollments
Out[20]:
HS Students in DE-Only Schools % DE-Only Schools HS Students in AP-Only Schools % AP-Only Schools HS Students in Schools w/ Neither % Neither Schools HS Students in Schools w/ Both % Both Schools Total
Locale
City 138677 3.4 1134989 28.1 167180 4.1 2602530 64.4 4043376
Rural 483935 17.4 337060 12.1 104517 3.8 1857241 66.7 2782753
Suburban 125741 2.2 1365559 24.2 84305 1.5 4075341 72.1 5650946
Town 216968 13.6 241668 15.1 55907 3.5 1085051 67.8 1599594

By School Non-White Student Percentage

In [21]:
hs_de_only['pct_eth'] = (hs_de_only['total_enrollment'] - hs_de_only['SCH_ENR_WH_F'] - hs_de_only['SCH_ENR_WH_M']) / hs_de_only['total_enrollment'] 
hs_AP_Only['pct_eth'] = (hs_AP_Only['total_enrollment'] - hs_AP_Only['SCH_ENR_WH_F'] - hs_AP_Only['SCH_ENR_WH_M']) / hs_AP_Only['total_enrollment'] 
hs_Neither_AP_DE['pct_eth'] = (hs_Neither_AP_DE['total_enrollment'] - hs_Neither_AP_DE['SCH_ENR_WH_F'] - hs_Neither_AP_DE['SCH_ENR_WH_M']) / hs_Neither_AP_DE['total_enrollment'] 
hs_Both_AP_DE['pct_eth'] = (hs_Both_AP_DE['total_enrollment'] - hs_Both_AP_DE['SCH_ENR_WH_F'] - hs_Both_AP_DE['SCH_ENR_WH_M']) / hs_Both_AP_DE['total_enrollment'] 

from my_functions.extra_functions import eth_grouper

hs_de_only['eth_quintile'] = hs_de_only['pct_eth'].apply(lambda x: eth_grouper(x))
hs_AP_Only['eth_quintile'] = hs_AP_Only['pct_eth'].apply(lambda x: eth_grouper(x))
hs_Neither_AP_DE['eth_quintile'] = hs_Neither_AP_DE['pct_eth'].apply(lambda x: eth_grouper(x))
hs_Both_AP_DE['eth_quintile'] = hs_Both_AP_DE['pct_eth'].apply(lambda x: eth_grouper(x))
In [22]:
"""Set up Grouped DataFrames"""
hs_de_only_eth = hs_de_only.groupby('eth_quintile')['LEAID'].count()
hs_de_only_eth.rename('DE Only', inplace = True);

hs_AP_Only_eth = hs_AP_Only.groupby('eth_quintile')['LEAID'].count()
hs_AP_Only_eth.rename('AP Only', inplace = True);

hs_Neither_AP_DE_eth = hs_Neither_AP_DE.groupby('eth_quintile')['LEAID'].count()
hs_Neither_AP_DE_eth.rename('Neither AP DE', inplace = True);

hs_Both_AP_DE_eth = hs_Both_AP_DE.groupby('eth_quintile')['LEAID'].count()
hs_Both_AP_DE_eth.rename('Both AP DE', inplace = True);

-- Schools

In [23]:
by_eth = pd.concat([hs_de_only_eth, hs_AP_Only_eth, hs_Neither_AP_DE_eth, hs_Both_AP_DE_eth], axis = 1)
by_eth['Total'] = by_eth['DE Only'] + by_eth['AP Only'] + by_eth['Both AP DE'] + by_eth['Neither AP DE']
by_eth = by_eth.rename({1:'0-20%', 2:'21-40%', 3:'41-60%', 4:'61-80%', 5:'81-100%'})

by_eth = add_de_ap_pcts(by_eth)
by_eth.index.name = 'Non-White %'
by_eth
Out[23]:
DE Only % DE-Only Schools in Group AP Only % AP-Only Schools in Group Neither AP DE % Neither Schools in Group Both AP DE % Both Schools in Group Total
Non-White %
0-20% 2134 30.0 843 11.8 603 8.5 3543 49.7 7123
21-40% 699 19.9 508 14.5 313 8.9 1986 56.6 3506
41-60% 351 14.5 422 17.5 237 9.8 1406 58.2 2416
61-80% 239 13.1 413 22.6 220 12.0 954 52.2 1826
81-100% 452 11.9 1115 29.2 672 17.6 1574 41.3 3813

-- Enrollments

In [24]:
enrollment_by_eth = de_ap_enrollments(hs_de_only, hs_AP_Only, hs_Neither_AP_DE, hs_Both_AP_DE, groupby_field = 'eth_quintile')
enrollment_by_eth = enrollment_by_eth.rename({1:'0-20%', 2:'21-40%', 3:'41-60%', 4:'61-80%', 5:'81-100%'})
enrollment_by_eth.index.names = ['Non-White %']
enrollment_by_eth
Out[24]:
HS Students in DE-Only Schools % DE-Only Schools HS Students in AP-Only Schools % AP-Only Schools HS Students in Schools w/ Neither % Neither Schools HS Students in Schools w/ Both % Both Schools Total
Non-White %
0-20% 475225 13.6 539882 15.4 97349 2.8 2383160 68.2 3495616
21-40% 169099 5.7 483055 16.4 56269 1.9 2238768 76.0 2947191
41-60% 102901 4.2 508840 20.8 44633 1.8 1787643 73.1 2444017
61-80% 79672 4.2 519079 27.1 47934 2.5 1266426 66.2 1913111
81-100% 138424 4.2 1028420 31.4 165724 5.1 1944166 59.3 3276734

By State

In [25]:
"""Which states have many schools offering DE but not AP?"""
hs_de_only_state = hs_de_only.groupby('LEA_STATE')['LEAID'].count().rename('DE Only')
hs_AP_Only_state = hs_AP_Only.groupby('LEA_STATE')['LEAID'].count().rename('AP Only')
hs_Neither_AP_DE_state = hs_Neither_AP_DE.groupby('LEA_STATE')['LEAID'].count().rename('Neither AP DE')
hs_Both_AP_DE_state = hs_Both_AP_DE.groupby('LEA_STATE')['LEAID'].count().rename('Both AP DE')

-- Schools

In [26]:
by_state = pd.concat([hs_de_only_state, hs_AP_Only_state, hs_Neither_AP_DE_state, hs_Both_AP_DE_state], axis = 1)
by_state = by_state.fillna(0).astype(int)
by_state['Total'] = by_state['DE Only'] + by_state['AP Only'] + by_state['Both AP DE'] + by_state['Neither AP DE']

by_state = add_de_ap_pcts(by_state)
by_state.index.names = ['State']
by_state
Out[26]:
DE Only % DE-Only Schools in Group AP Only % AP-Only Schools in Group Neither AP DE % Neither Schools in Group Both AP DE % Both Schools in Group Total
State
AK 68 28.0 13 5.3 133 54.7 29 11.9 243
AL 100 28.2 28 7.9 27 7.6 200 56.3 355
AR 12 4.4 57 20.8 6 2.2 199 72.6 274
AZ 58 14.4 69 17.1 155 38.4 122 30.2 404
CA 72 5.0 747 52.1 198 13.8 416 29.0 1433
CO 98 27.2 40 11.1 32 8.9 190 52.8 360
CT 22 10.7 61 29.6 13 6.3 110 53.4 206
DC 0 0.0 22 75.9 1 3.4 6 20.7 29
DE 5 13.9 10 27.8 1 2.8 20 55.6 36
FL 56 9.9 34 6.0 28 4.9 448 79.2 566
GA 33 7.8 29 6.9 13 3.1 348 82.3 423
HI 16 25.0 0 0.0 6 9.4 42 65.6 64
IA 154 46.7 1 0.3 8 2.4 167 50.6 330
ID 77 50.3 4 2.6 16 10.5 56 36.6 153
IL 179 26.7 102 15.2 51 7.6 339 50.5 671
IN 27 7.1 38 10.1 23 6.1 290 76.7 378
KS 200 60.4 14 4.2 37 11.2 80 24.2 331
KY 23 9.9 34 14.7 7 3.0 168 72.4 232
LA 101 32.3 24 7.7 16 5.1 172 55.0 313
MA 22 6.3 160 45.6 32 9.1 137 39.0 351
MD 3 1.4 26 11.9 15 6.9 174 79.8 218
ME 10 8.3 37 30.8 10 8.3 63 52.5 120
MI 166 24.6 52 7.7 61 9.0 396 58.7 675
MN 154 35.6 47 10.9 87 20.1 144 33.3 432
MO 281 51.2 23 4.2 45 8.2 200 36.4 549
MS 57 21.7 24 9.1 45 17.1 137 52.1 263
MT 44 26.3 22 13.2 46 27.5 55 32.9 167
NC 74 13.8 112 20.9 39 7.3 312 58.1 537
ND 101 64.3 0 0.0 21 13.4 35 22.3 157
NE 155 59.8 3 1.2 37 14.3 64 24.7 259
NH 9 10.0 28 31.1 8 8.9 45 50.0 90
NJ 15 3.6 129 31.4 18 4.4 249 60.6 411
NM 80 48.2 11 6.6 7 4.2 68 41.0 166
NV 17 14.8 44 38.3 19 16.5 35 30.4 115
NY 106 8.7 492 40.3 182 14.9 440 36.1 1220
OH 233 26.0 51 5.7 163 18.2 450 50.2 897
OK 125 28.1 56 12.6 80 18.0 184 41.3 445
OR 85 31.4 39 14.4 47 17.3 100 36.9 271
PA 66 9.7 198 29.2 45 6.6 368 54.4 677
RI 8 14.5 21 38.2 3 5.5 23 41.8 55
SC 32 14.0 6 2.6 11 4.8 180 78.6 229
SD 72 46.5 4 2.6 21 13.5 58 37.4 155
TN 114 32.4 24 6.8 36 10.2 178 50.6 352
TX 348 23.4 135 9.1 61 4.1 944 63.4 1488
UT 37 23.7 20 12.8 13 8.3 86 55.1 156
VA 21 6.5 33 10.3 1 0.3 266 82.9 321
VT 8 12.5 4 6.2 3 4.7 49 76.6 64
WA 53 14.5 80 21.9 50 13.7 182 49.9 365
WI 43 8.9 64 13.3 44 9.1 330 68.6 481
WV 4 3.3 27 22.3 8 6.6 82 67.8 121
WY 31 40.8 2 2.6 16 21.1 27 35.5 76

-- Enrollments

In [27]:
enrollments_by_state = de_ap_enrollments(hs_de_only, hs_AP_Only, hs_Neither_AP_DE, hs_Both_AP_DE, groupby_field = 'LEA_STATE')
enrollments_by_state.index.names = ['State']
enrollments_by_state
Out[27]:
HS Students in DE-Only Schools % DE-Only Schools HS Students in AP-Only Schools % AP-Only Schools HS Students in Schools w/ Neither % Neither Schools HS Students in Schools w/ Both % Both Schools Total
State
AK 4060 11.7 8650 24.9 4120 11.9 17872 51.5 34702
AL 30517 14.7 18741 9.0 8398 4.0 150118 72.3 207774
AR 2079 1.6 28372 22.0 2178 1.7 96046 74.6 128675
AZ 14986 4.8 73449 23.3 29884 9.5 196319 62.4 314638
CA 18812 1.1 1062092 60.9 53238 3.1 609230 34.9 1743372
CO 17606 7.4 26006 10.9 3582 1.5 190443 80.1 237637
CT 10819 6.7 51948 32.0 3091 1.9 96514 59.4 162372
DC 0 0.0 11954 82.3 153 1.1 2423 16.7 14530
DE 4801 12.7 9917 26.2 307 0.8 22833 60.3 37858
FL 18094 2.4 26677 3.5 6336 0.8 714567 93.3 765674
GA 13192 2.7 22253 4.5 1496 0.3 457316 92.5 494257
HI 2175 4.3 0 0.0 337 0.7 47983 95.0 50495
IA 35276 25.5 2008 1.4 1000 0.7 100262 72.4 138546
ID 18339 24.9 3187 4.3 2978 4.0 49167 66.7 73671
IL 48718 8.3 100788 17.2 10832 1.8 426842 72.7 587180
IN 10252 3.4 21212 7.0 13952 4.6 256040 84.9 301456
KS 39382 28.3 16328 11.7 5488 3.9 78036 56.0 139234
KY 8286 4.3 26181 13.7 602 0.3 155971 81.6 191040
LA 31039 17.0 15452 8.5 2293 1.3 133370 73.2 182154
MA 15857 5.6 142164 50.7 8521 3.0 114114 40.7 280656
MD 947 0.4 16474 6.5 5037 2.0 229443 91.1 251901
ME 977 1.9 15925 31.0 1258 2.5 33182 64.6 51342
MI 40877 9.9 34879 8.4 13133 3.2 326008 78.6 414897
MN 40944 17.0 42999 17.9 17054 7.1 139383 58.0 240380
MO 64229 24.3 23106 8.7 8812 3.3 168663 63.7 264810
MS 19129 13.7 13598 9.7 9861 7.1 97141 69.5 139729
MT 6176 14.8 4684 11.2 2935 7.0 28030 67.0 41825
NC 17128 3.8 119400 26.6 9150 2.0 303420 67.6 449098
ND 8825 30.2 0 0.0 1092 3.7 19346 66.1 29263
NE 21304 24.0 399 0.4 3339 3.8 63907 71.8 88949
NH 1273 2.2 22274 38.3 1195 2.1 33345 57.4 58087
NJ 6458 1.6 122711 30.5 6359 1.6 266382 66.3 401910
NM 12518 14.3 15845 18.1 906 1.0 58245 66.6 87514
NV 2363 1.8 90424 67.1 3087 2.3 38848 28.8 134722
NY 36660 4.6 311907 38.9 53780 6.7 399018 49.8 801365
OH 83268 16.3 34064 6.7 38099 7.5 354156 69.5 509587
OK 18376 10.4 24181 13.7 10898 6.2 122529 69.6 175984
OR 29507 18.1 25510 15.7 6103 3.8 101540 62.4 162660
PA 22723 4.5 176908 34.7 15935 3.1 293838 57.7 509404
RI 1886 4.7 18887 46.8 916 2.3 18640 46.2 40329
SC 12261 5.8 2730 1.3 1867 0.9 194099 92.0 210957
SD 6557 17.8 907 2.5 1277 3.5 28014 76.2 36755
TN 52294 18.5 19139 6.8 8642 3.1 202799 71.7 282874
TX 57985 4.1 95169 6.8 13319 0.9 1237983 88.1 1404456
UT 7355 4.9 17439 11.6 1607 1.1 123384 82.4 149785
VA 8318 2.2 49135 13.1 28 0.0 317202 84.7 374683
VT 1044 4.4 799 3.4 720 3.1 20935 89.1 23498
WA 23378 7.8 64850 21.6 9987 3.3 202517 67.3 300732
WI 10826 4.3 32624 13.1 4342 1.7 201835 80.9 249627
WV 587 0.7 14697 18.8 587 0.7 62468 79.7 78339
WY 4858 19.2 233 0.9 1798 7.1 18397 72.8 25286

By Region (Accreditation)

- Regions are broken down according to the regional accreditation guidelines.

    - Higher Learning Commission (HLC): Arkansas, Arizona, Colorado, Iowa, Illinois, Indiana, Kansas, Michigan,
      Minnesota, Missouri, North Dakota, Nebraska, New Mexico, Ohio, Oklahoma, South Dakota, Wisconsin, 
      West Virginia, and Wyoming. 

    - Middle States Commission on Higher Education (MSCHE): New York, New Jersey, Pennsylvania, Delaware, 
      Maryland, the District of Columbia.

    - New England Association of Schools and Colleges (NEASC): Connecticut, Maine, Massachusetts, New Hampshire,
      Rhode Island, and Vermont.

    - Northwest Commission on Colleges and Universities (NWCCU): Alaska, Idaho, Montana, Nevada, Oregon, 
      Utah, and Washington. 

    - Southern Association of Colleges and Schools (SACS): Alabama, Florida, Georgia, Kentucky, 
      Louisiana, Mississippi, North Carolina, South Carolina, Tennessee, Texas and Virginia.

    - Western Association of Schools and Colleges (WASC): Hawaii, California 
In [28]:
"""Set up the Region Column"""
from my_functions.extra_functions import region_mapper
hs_de_only['region_accred'] = hs_de_only['LEA_STATE'].apply(lambda x: region_mapper(x))
hs_AP_Only['region_accred'] = hs_AP_Only['LEA_STATE'].apply(lambda x: region_mapper(x))
hs_Neither_AP_DE['region_accred'] = hs_Neither_AP_DE['LEA_STATE'].apply(lambda x: region_mapper(x))
hs_Both_AP_DE['region_accred'] = hs_Both_AP_DE['LEA_STATE'].apply(lambda x: region_mapper(x))
In [29]:
"""Set up Grouped DataFrames"""
hs_de_only_region = hs_de_only.groupby('region_accred')['LEAID'].count()
hs_de_only_region.rename('DE Only', inplace=True);

hs_AP_Only_region = hs_AP_Only.groupby('region_accred')['LEAID'].count()
hs_AP_Only_region.rename('AP Only', inplace=True);

hs_Neither_AP_DE_region = hs_Neither_AP_DE.groupby('region_accred')['LEAID'].count()
hs_Neither_AP_DE_region.rename('Neither AP DE', inplace=True);

hs_Both_AP_DE_region = hs_Both_AP_DE.groupby('region_accred')['LEAID'].count()
hs_Both_AP_DE_region.rename('Both AP DE', inplace=True);

-- Schools

In [30]:
by_region = pd.concat([hs_de_only_region, hs_AP_Only_region, hs_Neither_AP_DE_region, hs_Both_AP_DE_region], axis = 1)
by_region['Total'] = by_region['DE Only'] + by_region['AP Only'] + by_region['Both AP DE'] + by_region['Neither AP DE']

by_region = add_de_ap_pcts(by_region)
by_region.index.names = ['Region']
by_region
Out[30]:
DE Only % DE-Only Schools in Group AP Only % AP-Only Schools in Group Neither AP DE % Neither Schools in Group Both AP DE % Both Schools in Group Total
Region
HLC 2173 30.3 661 9.2 902 12.6 3425 47.8 7161
MSCHE 195 7.5 877 33.8 262 10.1 1257 48.5 2591
NEASC 79 8.9 311 35.1 69 7.8 427 48.2 886
NWCCU 381 25.9 222 15.1 324 22.0 543 36.9 1470
SACS 959 18.9 483 9.5 284 5.6 3353 66.0 5079
WASC 88 5.9 747 49.9 204 13.6 458 30.6 1497

-- Enrollments

In [31]:
region_enrollments = de_ap_enrollments(hs_de_only, hs_AP_Only, hs_Neither_AP_DE,
                                       hs_Both_AP_DE, groupby_field = 'region_accred')
region_enrollments.index.name = 'Region'
region_enrollments
Out[31]:
HS Students in DE-Only Schools % DE-Only Schools HS Students in AP-Only Schools % AP-Only Schools HS Students in Schools w/ Neither % Neither Schools HS Students in Schools w/ Both % Both Schools Total
Region
HLC 481468 11.9 492097 12.2 168253 4.2 2906939 71.8 4048757
MSCHE 71589 3.5 649871 32.2 81571 4.0 1213937 60.2 2016968
NEASC 31856 5.2 251997 40.9 15701 2.5 316730 51.4 616284
NWCCU 91178 10.2 214744 23.9 30817 3.4 561358 62.5 898097
SACS 268243 5.7 408475 8.7 61992 1.3 3963986 84.3 4702696
WASC 20987 1.2 1062092 59.2 53575 3.0 657213 36.6 1793867

By Region (Census)

- Regions are broken down according to the regional accreditation guidelines.

    - New England - Connecticut, Maine, Massachusetts, New Hampshire, Rhode Island, and Vermont
    - Mid-Atlantic - New Jersey, New York, and Pennsylvania
    - East North Central - Illinois, Indiana, Michigan, Ohio, and Wisconsin
    - West North Central - Iowa, Kansas, Minnesota, Missouri, Nebraska, North Dakota, and South Dakota
    - South Atlantic - Delaware, Florida, Georgia, Maryland, North Carolina, South Carolina, 
      Virginia, District of Columbia, and West Virginia
    - East South Central - Alabama, Kentucky, Mississippi, and Tennessee
    - West South Central - Arkansas, Louisiana, Oklahoma, and Texas
    - Mountain - Arizona, Colorado, Idaho, Montana, Nevada, New Mexico, Utah, and Wyoming
    - Pacific - Alaska, California, Hawaii, Oregon, and Washington
In [32]:
"""Set up the Region Column"""
from my_functions.extra_functions import region_mapper_census
hs_de_only['region_census'] = hs_de_only['LEA_STATE'].apply(lambda x: region_mapper_census(x))
hs_AP_Only['region_census'] = hs_AP_Only['LEA_STATE'].apply(lambda x: region_mapper_census(x))
hs_Neither_AP_DE['region_census'] = hs_Neither_AP_DE['LEA_STATE'].apply(lambda x: region_mapper_census(x))
hs_Both_AP_DE['region_census'] = hs_Both_AP_DE['LEA_STATE'].apply(lambda x: region_mapper_census(x))
In [33]:
"""Set up Grouped DataFrames"""
hs_de_only_region_census = hs_de_only.groupby('region_census')['LEAID'].count()
hs_de_only_region_census.rename('DE Only', inplace=True);

hs_AP_Only_region_census = hs_AP_Only.groupby('region_census')['LEAID'].count()
hs_AP_Only_region_census.rename('AP Only', inplace=True);

hs_Neither_AP_DE_region_census = hs_Neither_AP_DE.groupby('region_census')['LEAID'].count()
hs_Neither_AP_DE_region_census.rename('Neither AP DE', inplace=True);

hs_Both_AP_DE_region_census = hs_Both_AP_DE.groupby('region_census')['LEAID'].count()
hs_Both_AP_DE_region_census.rename('Both AP DE', inplace=True);

-- Schools

In [34]:
by_region_census = pd.concat([hs_de_only_region_census, hs_AP_Only_region_census, hs_Neither_AP_DE_region_census, hs_Both_AP_DE_region_census], axis = 1)
by_region_census['Total'] = by_region_census['DE Only'] + by_region_census['AP Only'] + by_region_census['Both AP DE'] + by_region_census['Neither AP DE']

by_region_census = add_de_ap_pcts(by_region_census)
by_region_census.index.names = ['Region']
by_region_census
Out[34]:
DE Only % DE-Only Schools in Group AP Only % AP-Only Schools in Group Neither AP DE % Neither Schools in Group Both AP DE % Both Schools in Group Total
Region
East North Central 648 20.9 307 9.9 342 11.0 1805 58.2 3102
East South Central 294 24.5 110 9.2 115 9.6 683 56.8 1202
Middle Atlantic 187 8.1 819 35.5 245 10.6 1057 45.8 2308
Mountain 442 27.7 212 13.3 304 19.0 639 40.0 1597
New England 79 8.9 311 35.1 69 7.8 427 48.2 886
Pacific 294 12.4 879 37.0 434 18.3 769 32.4 2376
South Atlantic 228 9.2 299 12.1 117 4.7 1836 74.0 2480
West North Central 1117 50.5 92 4.2 256 11.6 748 33.8 2213
West South Central 586 23.3 272 10.8 163 6.5 1499 59.5 2520

-- Enrollments

In [35]:
region_enrollments_census = de_ap_enrollments(hs_de_only, hs_AP_Only, hs_Neither_AP_DE, 
                                              hs_Both_AP_DE, groupby_field = 'region_census')
region_enrollments_census.index.name = 'Region'
region_enrollments_census
Out[35]:
HS Students in DE-Only Schools % DE-Only Schools HS Students in AP-Only Schools % AP-Only Schools HS Students in Schools w/ Neither % Neither Schools HS Students in Schools w/ Both % Both Schools Total
Region
East North Central 193941 9.4 223567 10.8 80358 3.9 1564881 75.9 2062747
East South Central 110226 13.4 77659 9.5 27503 3.3 606029 73.8 821417
Middle Atlantic 65841 3.8 611526 35.7 76074 4.4 959238 56.0 1712679
Mountain 84201 7.9 231267 21.7 46777 4.4 702833 66.0 1065078
New England 31856 5.2 251997 40.9 15701 2.5 316730 51.4 616284
Pacific 77932 3.4 1161102 50.7 73785 3.2 979142 42.7 2291961
South Atlantic 75328 2.8 273237 10.2 24961 0.9 2303771 86.0 2677297
West North Central 216517 23.1 85747 9.1 38062 4.1 597611 63.7 937937
West South Central 109479 5.8 163174 8.6 28688 1.5 1589928 84.1 1891269

By Region (NACEP)

- Regions are broken down according to the regional accreditation guidelines.
    - 1 - New York, New Jersey, Pennslyvania, Delware, Maryland, Washington DC, Connecticut, Maine,
          Massachusettes, New Hampshire, Rhode Island, Vermont, Virginia
    - 2 - Michigan, Indiana, Ohio, West Virigina, Kentukcy, Tennessee, North Carolina, South Carolina,
          Alabama, Mississippi, Georgia, Florida
    - 3 - Illinois, Missouri, Arkansas, Louisiana, Oklahoma, Kansas, Texas
    - 4 - Montana, Idaho, Wyoming, North Dakota, South Dakota, Nebraska, Iowa, Minnesota, Wisconsin
    - 5 - Oregan, Washington, California, Nevada, Utah, Arizona, Colorado, New Mexico, Alaska, Hawaii
In [36]:
"""Set up the Region Column"""
from my_functions.extra_functions import region_mapper_nacep
hs_de_only['region_nacep'] = hs_de_only['LEA_STATE'].apply(lambda x: region_mapper_nacep(x))
hs_AP_Only['region_nacep'] = hs_AP_Only['LEA_STATE'].apply(lambda x: region_mapper_nacep(x))
hs_Neither_AP_DE['region_nacep'] = hs_Neither_AP_DE['LEA_STATE'].apply(lambda x: region_mapper_nacep(x))
hs_Both_AP_DE['region_nacep'] = hs_Both_AP_DE['LEA_STATE'].apply(lambda x: region_mapper_nacep(x))
In [37]:
"""Set up Grouped DataFrames"""
hs_de_only_region_nacep = hs_de_only.groupby('region_nacep')['LEAID'].count()
hs_de_only_region_nacep.rename('DE Only', inplace=True);

hs_AP_Only_region_nacep = hs_AP_Only.groupby('region_nacep')['LEAID'].count()
hs_AP_Only_region_nacep.rename('AP Only', inplace=True);

hs_Neither_AP_DE_region_nacep = hs_Neither_AP_DE.groupby('region_nacep')['LEAID'].count()
hs_Neither_AP_DE_region_nacep.rename('Neither AP DE', inplace=True);

hs_Both_AP_DE_region_nacep = hs_Both_AP_DE.groupby('region_nacep')['LEAID'].count()
hs_Both_AP_DE_region_nacep.rename('Both AP DE', inplace=True);

-- Schools

In [38]:
by_region_nacep = pd.concat([hs_de_only_region_nacep, hs_AP_Only_region_nacep, hs_Neither_AP_DE_region_nacep, hs_Both_AP_DE_region_nacep], axis = 1)
by_region_nacep['Total'] = by_region_nacep['DE Only'] + by_region_nacep['AP Only'] + by_region_nacep['Both AP DE'] + by_region_nacep['Neither AP DE']

by_region_nacep = add_de_ap_pcts(by_region_nacep)
by_region_nacep.index.names = ['Region']
by_region_nacep
Out[38]:
DE Only % DE-Only Schools in Group AP Only % AP-Only Schools in Group Neither AP DE % Neither Schools in Group Both AP DE % Both Schools in Group Total
Region
1 295 7.8 1221 32.1 332 8.7 1950 51.3 3798
2 919 18.3 459 9.1 461 9.2 3189 63.4 5028
3 1246 30.6 411 10.1 296 7.3 2118 52.0 4071
4 831 37.6 147 6.7 296 13.4 936 42.4 2210
5 584 16.3 1063 29.7 660 18.5 1270 35.5 3577

-- Enrollments

In [39]:
region_enrollments_nacep = de_ap_enrollments(hs_de_only, hs_AP_Only, hs_Neither_AP_DE, 
                                              hs_Both_AP_DE, groupby_field = 'region_nacep')
region_enrollments_nacep.index.name = 'Region'
region_enrollments_nacep
Out[39]:
HS Students in DE-Only Schools % DE-Only Schools HS Students in AP-Only Schools % AP-Only Schools HS Students in Schools w/ Neither % Neither Schools HS Students in Schools w/ Both % Both Schools Total
Region
1 111763 3.7 951003 31.6 97300 3.2 1847869 61.4 3007935
2 305885 7.6 353571 8.7 112123 2.8 3274103 80.9 4045682
3 261808 9.1 303396 10.5 53820 1.9 2263469 78.5 2882493
4 153105 16.6 87041 9.4 35815 3.9 648341 70.1 924302
5 132760 4.1 1384265 43.0 112851 3.5 1586381 49.3 3216257