{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Enrolments at Scottish Universities\n", "\n", "Investigating trends for female enrolment at Undergraduate level degree courses at Scottish Universities against male enrolment. Focus on Computing but also interested to view how Computing fairs against other subjects." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Import libraries\n", "import pandas as pd\n", "import numpy as np\n", "import janitor\n", "import matplotlib\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "import plotly.express as px\n", "from plotly.subplots import make_subplots\n", "import plotly.graph_objects as go" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Import 2014-2019 dataset" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 134380 entries, 0 to 134379\n", "Data columns (total 8 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 Subject Area 134380 non-null object\n", " 1 First year marker 134380 non-null object\n", " 2 Level of study 134380 non-null object\n", " 3 Mode of study 134380 non-null object\n", " 4 Country of HE provider 134380 non-null object\n", " 5 Sex 134380 non-null object\n", " 6 Academic Year 134380 non-null object\n", " 7 Number 134380 non-null int64 \n", "dtypes: int64(1), object(7)\n", "memory usage: 8.2+ MB\n" ] } ], "source": [ "# Read in 2014-2019 dataset\n", "df1 = pd.read_csv(r\"C:\\Users\\klc90\\my_python_projects\\project_women_in_STEM\\data\\HESA\\student_numbers_by_subject_and_sex_scotland\\2014-2019.csv\", header=17)\n", "df1.info()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### View unique values in each column\n", "\n", "This will allow us to filter for specific columns later." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['(1) Medicine & dentistry' '(2) Subjects allied to medicine'\n", " '(3) Biological sciences' '(4) Veterinary science'\n", " '(5) Agriculture & related subjects' '(6) Physical sciences'\n", " '(7) Mathematical sciences' '(8) Computer science'\n", " '(9) Engineering & technology' '(A) Architecture, building & planning'\n", " 'Total - Science subject areas' '(B) Social studies' '(C) Law'\n", " '(D) Business & administrative studies'\n", " '(E) Mass communications & documentation' '(F) Languages'\n", " '(G) Historical & philosophical studies' '(H) Creative arts & design'\n", " '(I) Education' '(J) Combined' 'Total - Non-science subject areas'\n", " 'Total']\n", "['All' 'First year' 'Other years']\n", "['All' 'Postgraduate (research)' 'Postgraduate (taught)'\n", " 'All postgraduate' 'First degree' 'Other undergraduate'\n", " 'All undergraduate']\n", "['Full-time' 'Part-time' 'All']\n", "['England' 'Northern Ireland' 'Scotland' 'Wales' 'All']\n" ] } ], "source": [ "print(df1[\"Subject Area\"].unique())\n", "print(df1[\"First year marker\"].unique())\n", "print(df1[\"Level of study\"].unique())\n", "print(df1[\"Mode of study\"].unique())\n", "print(df1[\"Country of HE provider\"].unique())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Cleaning and Prep" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# Headers to snakecase\n", "df1_clean = df1.clean_names()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "# Drop total rows (Total - Science subject areas, Total - Non-science subject areas, Total)\n", "df1_clean = df1_clean[(df1_clean[\"subject_area\"] != \"Total\") \n", " & (df1_clean[\"subject_area\"] != \"Total - Science subject areas\")\n", " & (df1_clean[\"subject_area\"] != \"Total - Non-science subject areas\")\n", " & (df1_clean[\"subject_area\"] != \"(J) Combined\")].copy()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Medicine & dentistry' 'Subjects allied to medicine'\n", " 'Biological sciences' 'Veterinary science'\n", " 'Agriculture & related subjects' 'Physical sciences'\n", " 'Mathematical sciences' 'Computer science' 'Engineering & technology'\n", " 'Architecture, building & planning' 'Social studies' 'Law'\n", " 'Business & administrative studies' 'Mass communications & documentation'\n", " 'Languages' 'Historical & philosophical studies' 'Creative arts & design'\n", " 'Education']\n" ] } ], "source": [ "# Remove the brackets and number/letter at the start of the Subject Area values\n", "df1_clean[\"subject_area\"] = df1_clean[\"subject_area\"].str[4:]\n", "print(df1_clean[\"subject_area\"].unique())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### What to investigate\n", "\n", "We are interested in Undergraduate study at Scottish universities. We'll focus on full-time study and first year enrolled." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(360, 8)" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Filter for Scotland, Undergraduate level of study, full-time study, first year enrolled\n", "ug_scotland_df = df1_clean[(df1_clean[\"first_year_marker\"] == \"First year\")\n", " & (df1_clean[\"country_of_he_provider\"] == \"Scotland\")\n", " & (df1_clean[\"level_of_study\"] == \"All undergraduate\")\n", " & (df1_clean[\"mode_of_study\"] == \"Full-time\")].copy()\n", "ug_scotland_df.shape" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
subject_areafirst_year_markerlevel_of_studymode_of_studycountry_of_he_providersexacademic_yearnumber
46480Computer scienceFirst yearAll undergraduateFull-timeScotlandFemale2014/15480
46481Computer scienceFirst yearAll undergraduateFull-timeScotlandMale2014/152335
46482Computer scienceFirst yearAll undergraduateFull-timeScotlandOther2014/150
46483Computer scienceFirst yearAll undergraduateFull-timeScotlandTotal2014/152815
46484Computer scienceFirst yearAll undergraduateFull-timeScotlandFemale2015/16470
46485Computer scienceFirst yearAll undergraduateFull-timeScotlandMale2015/162210
46486Computer scienceFirst yearAll undergraduateFull-timeScotlandOther2015/160
46487Computer scienceFirst yearAll undergraduateFull-timeScotlandTotal2015/162680
46488Computer scienceFirst yearAll undergraduateFull-timeScotlandFemale2016/17530
46489Computer scienceFirst yearAll undergraduateFull-timeScotlandMale2016/172460
46490Computer scienceFirst yearAll undergraduateFull-timeScotlandOther2016/170
46491Computer scienceFirst yearAll undergraduateFull-timeScotlandTotal2016/172990
46492Computer scienceFirst yearAll undergraduateFull-timeScotlandFemale2017/18530
46493Computer scienceFirst yearAll undergraduateFull-timeScotlandMale2017/182505
46494Computer scienceFirst yearAll undergraduateFull-timeScotlandOther2017/185
46495Computer scienceFirst yearAll undergraduateFull-timeScotlandTotal2017/183040
46496Computer scienceFirst yearAll undergraduateFull-timeScotlandFemale2018/19600
46497Computer scienceFirst yearAll undergraduateFull-timeScotlandMale2018/192920
46498Computer scienceFirst yearAll undergraduateFull-timeScotlandOther2018/195
46499Computer scienceFirst yearAll undergraduateFull-timeScotlandTotal2018/193525
\n", "
" ], "text/plain": [ " subject_area first_year_marker level_of_study mode_of_study \\\n", "46480 Computer science First year All undergraduate Full-time \n", "46481 Computer science First year All undergraduate Full-time \n", "46482 Computer science First year All undergraduate Full-time \n", "46483 Computer science First year All undergraduate Full-time \n", "46484 Computer science First year All undergraduate Full-time \n", "46485 Computer science First year All undergraduate Full-time \n", "46486 Computer science First year All undergraduate Full-time \n", "46487 Computer science First year All undergraduate Full-time \n", "46488 Computer science First year All undergraduate Full-time \n", "46489 Computer science First year All undergraduate Full-time \n", "46490 Computer science First year All undergraduate Full-time \n", "46491 Computer science First year All undergraduate Full-time \n", "46492 Computer science First year All undergraduate Full-time \n", "46493 Computer science First year All undergraduate Full-time \n", "46494 Computer science First year All undergraduate Full-time \n", "46495 Computer science First year All undergraduate Full-time \n", "46496 Computer science First year All undergraduate Full-time \n", "46497 Computer science First year All undergraduate Full-time \n", "46498 Computer science First year All undergraduate Full-time \n", "46499 Computer science First year All undergraduate Full-time \n", "\n", " country_of_he_provider sex academic_year number \n", "46480 Scotland Female 2014/15 480 \n", "46481 Scotland Male 2014/15 2335 \n", "46482 Scotland Other 2014/15 0 \n", "46483 Scotland Total 2014/15 2815 \n", "46484 Scotland Female 2015/16 470 \n", "46485 Scotland Male 2015/16 2210 \n", "46486 Scotland Other 2015/16 0 \n", "46487 Scotland Total 2015/16 2680 \n", "46488 Scotland Female 2016/17 530 \n", "46489 Scotland Male 2016/17 2460 \n", "46490 Scotland Other 2016/17 0 \n", "46491 Scotland Total 2016/17 2990 \n", "46492 Scotland Female 2017/18 530 \n", "46493 Scotland Male 2017/18 2505 \n", "46494 Scotland Other 2017/18 5 \n", "46495 Scotland Total 2017/18 3040 \n", "46496 Scotland Female 2018/19 600 \n", "46497 Scotland Male 2018/19 2920 \n", "46498 Scotland Other 2018/19 5 \n", "46499 Scotland Total 2018/19 3525 " ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Dataset per subject area\n", "# Get Computer Science subject area\n", "cs_ug_scotland_df = ug_scotland_df[ug_scotland_df[\"subject_area\"] == \"Computer science\"].copy()\n", "cs_ug_scotland_df" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Import 2019/2020 dataset" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "RangeIndex: 32944 entries, 0 to 32943\n", "Data columns (total 8 columns):\n", " # Column Non-Null Count Dtype \n", "--- ------ -------------- ----- \n", " 0 CAH level 1 32944 non-null object\n", " 1 First year marker 32944 non-null object\n", " 2 Level of study 32944 non-null object\n", " 3 Mode of study 32944 non-null object\n", " 4 Country of HE provider 32944 non-null object\n", " 5 Sex 32944 non-null object\n", " 6 Academic Year 32944 non-null object\n", " 7 Number 32944 non-null int64 \n", "dtypes: int64(1), object(7)\n", "memory usage: 2.0+ MB\n" ] } ], "source": [ "# Import 2019-2020 dataset\n", "df2 = pd.read_csv(r\"C:\\Users\\klc90\\my_python_projects\\project_women_in_STEM\\data\\HESA\\student_numbers_by_subject_and_sex_scotland\\2019-2020.csv\", header=14)\n", "df2.info()" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
CAH level 1First year markerLevel of studyMode of studyCountry of HE providerSexAcademic YearNumber
001 Medicine and dentistryAllAllAllAllFemale2019/2042610
101 Medicine and dentistryAllAllAllAllMale2019/2027605
201 Medicine and dentistryAllAllAllAllOther2019/20150
301 Medicine and dentistryAllAllAllAllTotal2019/2070370
401 Medicine and dentistryAllAllFull-timeAllFemale2019/2036470
\n", "
" ], "text/plain": [ " CAH level 1 First year marker Level of study Mode of study \\\n", "0 01 Medicine and dentistry All All All \n", "1 01 Medicine and dentistry All All All \n", "2 01 Medicine and dentistry All All All \n", "3 01 Medicine and dentistry All All All \n", "4 01 Medicine and dentistry All All Full-time \n", "\n", " Country of HE provider Sex Academic Year Number \n", "0 All Female 2019/20 42610 \n", "1 All Male 2019/20 27605 \n", "2 All Other 2019/20 150 \n", "3 All Total 2019/20 70370 \n", "4 All Female 2019/20 36470 " ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df2.head()" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['01 Medicine and dentistry' '02 Subjects allied to medicine'\n", " '03 Biological and sport sciences' '04 Psychology'\n", " '05 Veterinary sciences' '06 Agriculture, food and related studies'\n", " '07 Physical sciences' '08 General and others in sciences'\n", " '09 Mathematical sciences' '10 Engineering and technology' '11 Computing'\n", " '12 Geographical and environmental studies (natural sciences)'\n", " '13 Architecture, building and planning' 'Total science CAH level 1'\n", " '12 Geographical and environmental studies (social sciences)'\n", " '14 Humanities and liberal arts (non-specific)' '15 Social sciences'\n", " '16 Law' '17 Business and management' '18 Communications and media'\n", " '19 Language and area studies'\n", " '20 Historical, philosophical and religious studies'\n", " '21 Creative arts and design' '22 Education and teaching'\n", " '23 Combined and general studies' 'Total non-science CAH level 1' 'Total']\n", "['All' 'First year' 'Other years']\n", "['All' 'Postgraduate (research)' 'Postgraduate (taught)'\n", " 'All postgraduate' 'First degree' 'Other undergraduate'\n", " 'All undergraduate']\n", "['All' 'Full-time' 'Part-time']\n", "['All' 'England' 'Northern Ireland' 'Scotland' 'Wales']\n" ] } ], "source": [ "# View unique values in each column to see what can be filtered\n", "print(df2[\"CAH level 1\"].unique())\n", "print(df2[\"First year marker\"].unique())\n", "print(df2[\"Level of study\"].unique())\n", "print(df2[\"Mode of study\"].unique())\n", "print(df2[\"Country of HE provider\"].unique())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Clean and prep" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [], "source": [ "# Headers to snakecase\n", "df2_clean = df2.clean_names()" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "# Drop total rows (Total - Science subject areas, Total - Non-science subject areas, Total)\n", "df2_clean = df2_clean[(df2_clean[\"cah_level_1\"] != \"Total\") \n", " & (df2_clean[\"cah_level_1\"] != \"Total science CAH level 1\")\n", " & (df2_clean[\"cah_level_1\"] != \"Total non-science CAH level 1\")\n", " & (df2_clean[\"cah_level_1\"] != \"Combined and general studies\")].copy()" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "['Medicine and dentistry' 'Subjects allied to medicine'\n", " 'Biological and sport sciences' 'Psychology' 'Veterinary sciences'\n", " 'Agriculture, food and related studies' 'Physical sciences'\n", " 'General and others in sciences' 'Mathematical sciences'\n", " 'Engineering and technology' 'Computing'\n", " 'Geographical and environmental studies (natural sciences)'\n", " 'Architecture, building and planning'\n", " 'Geographical and environmental studies (social sciences)'\n", " 'Humanities and liberal arts (non-specific)' 'Social sciences' 'Law'\n", " 'Business and management' 'Communications and media'\n", " 'Language and area studies'\n", " 'Historical, philosophical and religious studies'\n", " 'Creative arts and design' 'Education and teaching'\n", " 'Combined and general studies']\n" ] } ], "source": [ "# Remove the brackets and number/letter at the start of the Subject Area values\n", "df2_clean[\"cah_level_1\"] = df2_clean[\"cah_level_1\"].str[3:]\n", "print(df2_clean[\"cah_level_1\"].unique())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Filter for subset" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(96, 8)" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Filter for Scotland, Undergraduate level of study, and full-time study\n", "ug_scotland_df2 = df2_clean[(df2_clean[\"first_year_marker\"] == \"First year\")\n", " & (df2_clean[\"country_of_he_provider\"] == \"Scotland\")\n", " & (df2_clean[\"level_of_study\"] == \"All undergraduate\")\n", " & (df2_clean[\"mode_of_study\"] == \"Full-time\")].copy()\n", "ug_scotland_df2.shape" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(4, 8)" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# Get Computing subject area\n", "cs_ug_scotland_df2 = ug_scotland_df2[ug_scotland_df2[\"cah_level_1\"] == \"Computing\"].copy()\n", "cs_ug_scotland_df2.shape" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [], "source": [ "# Append datasets\n", "# Rename column\n", "cs_ug_scotland_df2.rename(columns={\"cah_level_1\": \"subject_area\"}, inplace=True)\n", "\n", "# Append\n", "cs_ug_scotland_df3 = cs_ug_scotland_df.append(cs_ug_scotland_df2, ignore_index=True)\n", "\n", "# Drop \"Other\"\n", "cs_ug_scotland_df3 = cs_ug_scotland_df3[cs_ug_scotland_df3[\"sex\"] != \"Other\"]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Investigate trends in Computing UG degrees in Scottish Universities" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [], "source": [ "### Line plot trend\n", "# plt.figure(figsize=(16, 6))\n", "\n", "# sns.lineplot(x=\"academic_year\", y=\"number\", hue=\"sex\", data=cs_ug_scotland_df3)\n", "# plt.title(\"Number of first year enrolments in UG Computer degrees at Scottish Universities\")\n", "# plt.ylabel(\"Enrolments\")\n", "# plt.xlabel(\"Academic year\")\n", "# plt.show()" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "hovertemplate": "sex=Female
academic_year=%{x}
number=%{y}", "legendgroup": "Female", "marker": { "color": "#636efa" }, "name": "Female", "offsetgroup": "Female", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "2014/15", "2015/16", "2016/17", "2017/18", "2018/19", "2019/20" ], "xaxis": "x", "y": [ 480, 470, 530, 530, 600, 670 ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "sex=Male
academic_year=%{x}
number=%{y}", "legendgroup": "Male", "marker": { "color": "#EF553B" }, "name": "Male", "offsetgroup": "Male", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "2014/15", "2015/16", "2016/17", "2017/18", "2018/19", "2019/20" ], "xaxis": "x", "y": [ 2335, 2210, 2460, 2505, 2920, 2890 ], "yaxis": "y" } ], "layout": { "barmode": "relative", "legend": { "title": { "text": "sex" }, "tracegroupgap": 0 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Proportion of males and females enrolling in UG Computing degress at Scottish Universities" }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "academic_year" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "number" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Drop total rows\n", "cs_ug_scotland_sex = cs_ug_scotland_df3[cs_ug_scotland_df3[\"sex\"] != \"Total\"].copy()\n", "\n", "fig = px.bar(cs_ug_scotland_sex, x=\"academic_year\", y='number', color='sex', orientation='v',\n", " labels={\"Academic year\", \"Enrolments\", \"Sex\"},\n", " title=\"Proportion of males and females enrolling in UG Computing degress at Scottish Universities\")\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "scrolled": false }, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "hovertemplate": "academic_year=2014/15
sex=%{x}
number=%{y}", "legendgroup": "2014/15", "marker": { "color": "#636EFA" }, "name": "2014/15", "offsetgroup": "2014/15", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "Female", "Male" ], "xaxis": "x", "y": [ 480, 2335 ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "academic_year=2015/16
sex=%{x}
number=%{y}", "legendgroup": "2015/16", "marker": { "color": "#EF553B" }, "name": "2015/16", "offsetgroup": "2015/16", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "Female", "Male" ], "xaxis": "x", "y": [ 470, 2210 ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "academic_year=2016/17
sex=%{x}
number=%{y}", "legendgroup": "2016/17", "marker": { "color": "#00CC96" }, "name": "2016/17", "offsetgroup": "2016/17", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "Female", "Male" ], "xaxis": "x", "y": [ 530, 2460 ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "academic_year=2017/18
sex=%{x}
number=%{y}", "legendgroup": "2017/18", "marker": { "color": "#AB63FA" }, "name": "2017/18", "offsetgroup": "2017/18", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "Female", "Male" ], "xaxis": "x", "y": [ 530, 2505 ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "academic_year=2018/19
sex=%{x}
number=%{y}", "legendgroup": "2018/19", "marker": { "color": "#FFA15A" }, "name": "2018/19", "offsetgroup": "2018/19", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "Female", "Male" ], "xaxis": "x", "y": [ 600, 2920 ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "academic_year=2019/20
sex=%{x}
number=%{y}", "legendgroup": "2019/20", "marker": { "color": "#19D3F3" }, "name": "2019/20", "offsetgroup": "2019/20", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "Female", "Male" ], "xaxis": "x", "y": [ 670, 2890 ], "yaxis": "y" } ], "layout": { "barmode": "group", "legend": { "title": { "text": "academic_year" }, "tracegroupgap": 0 }, "margin": { "t": 60 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Number of males and females enrolling in Computing UG courses in Scotland", "x": 0.5, "xanchor": "center", "y": 0.95, "yanchor": "top" }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "sex" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "number" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Plot \n", "fig = px.bar(cs_ug_scotland_sex, x='sex', y='number', color=\"academic_year\", orientation='v', barmode=\"group\",\n", " color_discrete_sequence=px.colors.qualitative.Plotly)\n", "\n", "# Format title\n", "fig.update_layout(\n", " title={\n", " 'text': \"Number of males and females enrolling in Computing UG courses in Scotland\",\n", " 'y':0.95,\n", " 'x':0.5,\n", " 'xanchor': 'center',\n", " 'yanchor': 'top'})\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Female enrollment in other subjects" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Unique subjects for 2014-2019 ['Medicine & dentistry' 'Subjects allied to medicine'\n", " 'Biological sciences' 'Veterinary science'\n", " 'Agriculture & related subjects' 'Physical sciences'\n", " 'Mathematical sciences' 'Computer science' 'Engineering & technology'\n", " 'Architecture, building & planning' 'Social studies' 'Law'\n", " 'Business & administrative studies' 'Mass communications & documentation'\n", " 'Languages' 'Historical & philosophical studies' 'Creative arts & design'\n", " 'Education']\n", "Unique subjects for 2019-2020 ['Medicine and dentistry' 'Subjects allied to medicine'\n", " 'Biological and sport sciences' 'Psychology' 'Veterinary sciences'\n", " 'Agriculture, food and related studies' 'Physical sciences'\n", " 'General and others in sciences' 'Mathematical sciences'\n", " 'Engineering and technology' 'Computing'\n", " 'Geographical and environmental studies (natural sciences)'\n", " 'Architecture, building and planning'\n", " 'Geographical and environmental studies (social sciences)'\n", " 'Humanities and liberal arts (non-specific)' 'Social sciences' 'Law'\n", " 'Business and management' 'Communications and media'\n", " 'Language and area studies'\n", " 'Historical, philosophical and religious studies'\n", " 'Creative arts and design' 'Education and teaching'\n", " 'Combined and general studies']\n" ] } ], "source": [ "# View subjects for 2014-2019\n", "print(\"Unique subjects for 2014-2019\", df1_clean[\"subject_area\"].unique())\n", "\n", "# View subjects for 2019-2020\n", "print(\"\"\"Unique subjects for 2019-2020\"\"\",\n", " df2_clean[\"cah_level_1\"].unique())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note: Some subject categories have updated though some may still be comparable." ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "hovertemplate": "sex=Female
academic_year=%{x}
number=%{y}", "legendgroup": "Female", "marker": { "color": "#636efa" }, "name": "Female", "offsetgroup": "Female", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "2014/15", "2015/16", "2016/17", "2017/18", "2018/19", "2019/20" ], "xaxis": "x", "y": [ 430, 400, 370, 425, 455, 430 ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "sex=Male
academic_year=%{x}
number=%{y}", "legendgroup": "Male", "marker": { "color": "#EF553B" }, "name": "Male", "offsetgroup": "Male", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "2014/15", "2015/16", "2016/17", "2017/18", "2018/19", "2019/20" ], "xaxis": "x", "y": [ 470, 535, 525, 585, 585, 560 ], "yaxis": "y" } ], "layout": { "barmode": "relative", "legend": { "title": { "text": "sex" }, "tracegroupgap": 0 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Proportion of males and females enrolling in UG Mathematical Science degress at Scottish Universities" }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "academic_year" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "number" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Get Maths subject area\n", "maths_ug_scotland_df1 = ug_scotland_df[ug_scotland_df[\"subject_area\"] == \"Mathematical sciences\"].copy()\n", "maths_ug_scotland_df2 = ug_scotland_df2[ug_scotland_df2[\"cah_level_1\"] == \"Mathematical sciences\"].copy()\n", "\n", "# Append datasets\n", "# Rename column\n", "maths_ug_scotland_df2.rename(columns={\"cah_level_1\": \"subject_area\"}, inplace=True)\n", "\n", "# Append\n", "maths_ug_scotland_df3 = maths_ug_scotland_df1.append(maths_ug_scotland_df2, ignore_index=True)\n", "maths_ug_scotland_df3\n", "\n", "# Drop \"Other\"\n", "maths_ug_scotland_df3 = maths_ug_scotland_df3[maths_ug_scotland_df3[\"sex\"] != \"Other\"]\n", "\n", "# Drop total rows\n", "maths_ug_scotland_sex = maths_ug_scotland_df3[maths_ug_scotland_df3[\"sex\"] != \"Total\"].copy()\n", "\n", "fig = px.bar(maths_ug_scotland_sex, x=\"academic_year\", y='number', color='sex', orientation='v',\n", " labels={\"Academic year\", \"Enrolments\", \"Sex\"},\n", " title=\"Proportion of males and females enrolling in UG Mathematical Science degress at Scottish Universities\")\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "alignmentgroup": "True", "hovertemplate": "academic_year=2014/15
sex=%{x}
number=%{y}", "legendgroup": "2014/15", "marker": { "color": "#636EFA" }, "name": "2014/15", "offsetgroup": "2014/15", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "Female", "Male" ], "xaxis": "x", "y": [ 430, 470 ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "academic_year=2015/16
sex=%{x}
number=%{y}", "legendgroup": "2015/16", "marker": { "color": "#EF553B" }, "name": "2015/16", "offsetgroup": "2015/16", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "Female", "Male" ], "xaxis": "x", "y": [ 400, 535 ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "academic_year=2016/17
sex=%{x}
number=%{y}", "legendgroup": "2016/17", "marker": { "color": "#00CC96" }, "name": "2016/17", "offsetgroup": "2016/17", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "Female", "Male" ], "xaxis": "x", "y": [ 370, 525 ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "academic_year=2017/18
sex=%{x}
number=%{y}", "legendgroup": "2017/18", "marker": { "color": "#AB63FA" }, "name": "2017/18", "offsetgroup": "2017/18", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "Female", "Male" ], "xaxis": "x", "y": [ 425, 585 ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "academic_year=2018/19
sex=%{x}
number=%{y}", "legendgroup": "2018/19", "marker": { "color": "#FFA15A" }, "name": "2018/19", "offsetgroup": "2018/19", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "Female", "Male" ], "xaxis": "x", "y": [ 455, 585 ], "yaxis": "y" }, { "alignmentgroup": "True", "hovertemplate": "academic_year=2019/20
sex=%{x}
number=%{y}", "legendgroup": "2019/20", "marker": { "color": "#19D3F3" }, "name": "2019/20", "offsetgroup": "2019/20", "orientation": "v", "showlegend": true, "textposition": "auto", "type": "bar", "x": [ "Female", "Male" ], "xaxis": "x", "y": [ 430, 560 ], "yaxis": "y" } ], "layout": { "barmode": "group", "legend": { "title": { "text": "academic_year" }, "tracegroupgap": 0 }, "margin": { "t": 60 }, "template": { "data": { "bar": [ { "error_x": { "color": "#2a3f5f" }, "error_y": { "color": "#2a3f5f" }, "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "bar" } ], "barpolar": [ { "marker": { "line": { "color": "#E5ECF6", "width": 0.5 } }, "type": "barpolar" } ], "carpet": [ { "aaxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "baxis": { "endlinecolor": "#2a3f5f", "gridcolor": "white", "linecolor": "white", "minorgridcolor": "white", "startlinecolor": "#2a3f5f" }, "type": "carpet" } ], "choropleth": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "choropleth" } ], "contour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "contour" } ], "contourcarpet": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "contourcarpet" } ], "heatmap": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmap" } ], "heatmapgl": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "heatmapgl" } ], "histogram": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "histogram" } ], "histogram2d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2d" } ], "histogram2dcontour": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "histogram2dcontour" } ], "mesh3d": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "type": "mesh3d" } ], "parcoords": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "parcoords" } ], "pie": [ { "automargin": true, "type": "pie" } ], "scatter": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter" } ], "scatter3d": [ { "line": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatter3d" } ], "scattercarpet": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattercarpet" } ], "scattergeo": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergeo" } ], "scattergl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattergl" } ], "scattermapbox": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scattermapbox" } ], "scatterpolar": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolar" } ], "scatterpolargl": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterpolargl" } ], "scatterternary": [ { "marker": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "type": "scatterternary" } ], "surface": [ { "colorbar": { "outlinewidth": 0, "ticks": "" }, "colorscale": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "type": "surface" } ], "table": [ { "cells": { "fill": { "color": "#EBF0F8" }, "line": { "color": "white" } }, "header": { "fill": { "color": "#C8D4E3" }, "line": { "color": "white" } }, "type": "table" } ] }, "layout": { "annotationdefaults": { "arrowcolor": "#2a3f5f", "arrowhead": 0, "arrowwidth": 1 }, "autotypenumbers": "strict", "coloraxis": { "colorbar": { "outlinewidth": 0, "ticks": "" } }, "colorscale": { "diverging": [ [ 0, "#8e0152" ], [ 0.1, "#c51b7d" ], [ 0.2, "#de77ae" ], [ 0.3, "#f1b6da" ], [ 0.4, "#fde0ef" ], [ 0.5, "#f7f7f7" ], [ 0.6, "#e6f5d0" ], [ 0.7, "#b8e186" ], [ 0.8, "#7fbc41" ], [ 0.9, "#4d9221" ], [ 1, "#276419" ] ], "sequential": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ], "sequentialminus": [ [ 0, "#0d0887" ], [ 0.1111111111111111, "#46039f" ], [ 0.2222222222222222, "#7201a8" ], [ 0.3333333333333333, "#9c179e" ], [ 0.4444444444444444, "#bd3786" ], [ 0.5555555555555556, "#d8576b" ], [ 0.6666666666666666, "#ed7953" ], [ 0.7777777777777778, "#fb9f3a" ], [ 0.8888888888888888, "#fdca26" ], [ 1, "#f0f921" ] ] }, "colorway": [ "#636efa", "#EF553B", "#00cc96", "#ab63fa", "#FFA15A", "#19d3f3", "#FF6692", "#B6E880", "#FF97FF", "#FECB52" ], "font": { "color": "#2a3f5f" }, "geo": { "bgcolor": "white", "lakecolor": "white", "landcolor": "#E5ECF6", "showlakes": true, "showland": true, "subunitcolor": "white" }, "hoverlabel": { "align": "left" }, "hovermode": "closest", "mapbox": { "style": "light" }, "paper_bgcolor": "white", "plot_bgcolor": "#E5ECF6", "polar": { "angularaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "radialaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "scene": { "xaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "yaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" }, "zaxis": { "backgroundcolor": "#E5ECF6", "gridcolor": "white", "gridwidth": 2, "linecolor": "white", "showbackground": true, "ticks": "", "zerolinecolor": "white" } }, "shapedefaults": { "line": { "color": "#2a3f5f" } }, "ternary": { "aaxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "baxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" }, "bgcolor": "#E5ECF6", "caxis": { "gridcolor": "white", "linecolor": "white", "ticks": "" } }, "title": { "x": 0.05 }, "xaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 }, "yaxis": { "automargin": true, "gridcolor": "white", "linecolor": "white", "ticks": "", "title": { "standoff": 15 }, "zerolinecolor": "white", "zerolinewidth": 2 } } }, "title": { "text": "Number of males and females enrolling in UG Mathematical Science degrees in Scotland", "x": 0.5, "xanchor": "center", "y": 0.95, "yanchor": "top" }, "xaxis": { "anchor": "y", "domain": [ 0, 1 ], "title": { "text": "sex" } }, "yaxis": { "anchor": "x", "domain": [ 0, 1 ], "title": { "text": "number" } } } }, "text/html": [ "
" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Plot \n", "fig = px.bar(maths_ug_scotland_sex, x='sex', y='number', color=\"academic_year\", orientation='v', barmode=\"group\",\n", " color_discrete_sequence=px.colors.qualitative.Plotly)\n", "\n", "# Format title\n", "fig.update_layout(\n", " title={\n", " 'text': \"Number of males and females enrolling in UG Mathematical Science degrees in Scotland\",\n", " 'y':0.95,\n", " 'x':0.5,\n", " 'xanchor': 'center',\n", " 'yanchor': 'top'})\n", "\n", "fig.show()" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [], "source": [ "# Append datasets\n", "# Rename column\n", "ug_scotland_df2.rename(columns={\"cah_level_1\": \"subject_area\"}, inplace=True)\n", "\n", "# Append\n", "ug_scotland_df3 = ug_scotland_df.append(ug_scotland_df2, ignore_index=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Issues with above analysis\n", "\n", "A new subject coding system - the Higher Education Classification of Subjects (HECoS) - was been implemented from 2019/20. This replaced the old system - the Joint Academic Coding System (JACS).\n", "\n", "Also the above datasets are for enrollments to Scottish Universities regardless of the students domicile, i.e., where they consider home. This means students from other parts of the UK and abroad are included in this analysis." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }