<jupyter_start><jupyter_text>Looking at Baltimore Public School Enrollment 2019-2020 *   Change in enrollment 2019-2020; how has covid affected enrollment?*   how is this different for different counties?*   how is this different for different grade levels?  Import libraries<jupyter_code>#pip install plotly
# import libraries

#for data analysis
import pandas as pd
import numpy as np

#for viz
import plotly.express as px<jupyter_output><empty_output><jupyter_text>import data<jupyter_code># import data 

#2019 enrollment data
df_19_enroll = pd.read_csv("https://raw.githubusercontent.com/jhu-business-analytics/bcpss-enrollment-data/main/Enrollment_2019.csv")

# preview data

df_19_enroll.head()
#import rest of the data

# 2020 enrollment data
df_20_enroll = pd.read_csv("https://raw.githubusercontent.com/jhu-business-analytics/bcpss-enrollment-data/main/Enrollment_By_Grade_2020.csv")

#2019 attendance data
df_19_attend = pd.read_csv("https://raw.githubusercontent.com/jhu-business-analytics/bcpss-enrollment-data/main/Attendance_2019.csv")
#preview 2020 enrollment
df_20_enroll.head(10)
#preview the attendance data
df_19_attend.tail()
df_19_enroll.columns
df_19_enroll["LSS Name"].unique()<jupyter_output><empty_output><jupyter_text>Filter data for baltimore city only<jupyter_code># look at all of the column names
df_19_enroll.columns
# look at unique values in LSS name
df_19_enroll["LSS Name"].unique()
df_19_enroll["School Name"].nunique()
df_19_enroll.info()
df_19_enroll.describe()
df_19_enroll.head()
# filter data for baltimore city only
df_19_enroll_bmore = df_19_enroll[df_19_enroll["LSS Name"] == "Baltimore City"]
#preview bmore only data
df_19_enroll_bmore.head(10)
# filter by total enrollment
df_19_enroll_bmore = df_19_enroll_bmore[df_19_enroll_bmore["Grade"] == "Total Enrollment"]
#preview data
df_19_enroll_bmore.head(10)
# filter 2020 enrollment data 
df_20_enroll_bmore = df_20_enroll[(df_20_enroll["LSS Name"] == "Baltimore City") & (df_20_enroll["Grade"] == "All Grades")]
df_20_enroll_bmore.head(10)<jupyter_output><empty_output><jupyter_text>Merge 2019 and 2020 Enrollment<jupyter_code>#merge 2019 and 2020 data

df_10_20_merge = pd.merge(df_19_enroll_bmore, 
                          df_20_enroll_bmore[["School Name", "Enrolled Count"]], 
                          how = "left", 
                          on = "School Name")
df_10_20_merge.head()
# rename x for 2019 and y for 2020
df_10_20_merge = df_10_20_merge.rename(columns={"Enrolled Count_x": "Enrolled Count 2019",
                               "Enrolled Count_y": "Enrolled Count 2020"})
df_10_20_merge.head(10)<jupyter_output><empty_output><jupyter_text>Calculate Percent Change in a new column<jupyter_code># change datatype of enrollment to float
df_10_20_merge["Enrollment Count 2019"] = df_10_20_merge["Enrolled Count 2019"].astype(float)
df_10_20_merge.info()
# change datatype of enrollment to float
df_10_20_merge["Enrollment Count 2020"] = df_10_20_merge["Enrolled Count 2020"].astype(float)
#percent enrollment change in 2020
df_10_20_merge["Enrollment Change"] = (df_10_20_merge["Enrollment Count 2020"] - df_10_20_merge["Enrollment Count 2019"])/df_10_20_merge["Enrollment Count 2020"]
df_10_20_merge.head()
#change enrollment change to percent
df_10_20_merge["Enrollment Change"] = df_10_20_merge["Enrollment Change"]*100
df_10_20_merge.head(10)<jupyter_output><empty_output><jupyter_text>Bar Graph of Enrollment Change<jupyter_code># create a bar chart of enrollment change

bar_enrollment = px.bar(df_10_20_merge,x= "School Name", y = "Enrollment Change", title = "Enrollment Change in BCPSS, 2019-2020")
# sort values

df_10_20_merge = df_10_20_merge.sort_values(by = "Enrollment Change")
df_10_20_merge.head(10)
bar_enrollment













import plotly.express as px
bar_enrollment = px.bar(df_10_20_merge, x = "School Name", y = "Enrollment Change", title = "Enrollment Change 2019-2020, BCPSS")
bar_enrollment
df_10_20_merge = df_10_20_merge.sort_values(by = "Enrollment Change")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1009675018605805, 'fraction_numerical': 0.07516745224510048, 'mean_word_length': 6.024390243902439, 'pattern_counts': {'":': 2, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '82437', 'license': 'MIT', 'n_tokens_mistral': 1637, 'n_tokens_neox': 1423, 'n_words': 310, 'path': '2020_11_03_bcpss_enrollment_2020_melanieshimano.ipynb', 'repo_name': 'melanieshimano/bcpss-enrollment-data', 'size': '4031'}