Skip to content

Instantly share code, notes, and snippets.

@kidpixo
Last active February 18, 2022 15:58
Show Gist options
  • Save kidpixo/ba4ee5ab4565bc8988798c0a46b1a2c4 to your computer and use it in GitHub Desktop.
Save kidpixo/ba4ee5ab4565bc8988798c0a46b1a2c4 to your computer and use it in GitHub Desktop.
lpsc2022 fees analysis
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 45,
"id": "6e1995af-ff34-4f53-a0fe-f96239a3255e",
"metadata": {
"execution": {
"iopub.execute_input": "2022-02-18T14:02:34.220881Z",
"iopub.status.busy": "2022-02-18T14:02:34.220705Z",
"iopub.status.idle": "2022-02-18T14:02:34.223240Z",
"shell.execute_reply": "2022-02-18T14:02:34.222727Z",
"shell.execute_reply.started": "2022-02-18T14:02:34.220865Z"
},
"tags": []
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import numpy as np"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "d7da2795-2e1a-4ed3-857f-5c0924e67373",
"metadata": {
"execution": {
"iopub.execute_input": "2022-02-18T13:53:18.643547Z",
"iopub.status.busy": "2022-02-18T13:53:18.643293Z",
"iopub.status.idle": "2022-02-18T13:53:19.898184Z",
"shell.execute_reply": "2022-02-18T13:53:19.897839Z",
"shell.execute_reply.started": "2022-02-18T13:53:18.643531Z"
},
"tags": []
},
"outputs": [],
"source": [
"lpsc_df = pd.read_html('https://www.hou.usra.edu/meetings/lpsc2022/registration/')"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "c8e45b5c-20df-4ff3-b3fd-0d0c9b61acdf",
"metadata": {
"execution": {
"iopub.execute_input": "2022-02-18T14:01:52.122553Z",
"iopub.status.busy": "2022-02-18T14:01:52.122416Z",
"iopub.status.idle": "2022-02-18T14:01:52.130468Z",
"shell.execute_reply": "2022-02-18T14:01:52.130004Z",
"shell.execute_reply.started": "2022-02-18T14:01:52.122536Z"
},
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>early</th>\n",
" <th>standard</th>\n",
" </tr>\n",
" <tr>\n",
" <th>kind</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Professionals</th>\n",
" <td>585.0</td>\n",
" <td>630.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Students</th>\n",
" <td>485.0</td>\n",
" <td>510.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" early standard\n",
"kind \n",
"Professionals 585.0 630.0\n",
"Students 485.0 510.0"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lpsc_inperson_df = lpsc_df[0]\n",
"lpsc_inperson_df.columns = ['kind','early','standard','']\n",
"lpsc_inperson_df = lpsc_inperson_df.drop(index=[0,3],columns=[lpsc_inperson_df.columns[-1]])\n",
"lpsc_inperson_df.set_index('kind',inplace=True)\n",
"lpsc_inperson_df = lpsc_inperson_df.applymap(lambda x: float(x[1:]))\n",
"lpsc_inperson_df"
]
},
{
"cell_type": "code",
"execution_count": 42,
"id": "93390dd5-baee-4eb6-8c73-7f1f1807bb15",
"metadata": {
"execution": {
"iopub.execute_input": "2022-02-18T14:01:50.457183Z",
"iopub.status.busy": "2022-02-18T14:01:50.457025Z",
"iopub.status.idle": "2022-02-18T14:01:50.464707Z",
"shell.execute_reply": "2022-02-18T14:01:50.464240Z",
"shell.execute_reply.started": "2022-02-18T14:01:50.457166Z"
},
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>early</th>\n",
" <th>standard</th>\n",
" </tr>\n",
" <tr>\n",
" <th>kind</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Professionals</th>\n",
" <td>430.0</td>\n",
" <td>470.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Students</th>\n",
" <td>330.0</td>\n",
" <td>395.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" early standard\n",
"kind \n",
"Professionals 430.0 470.0\n",
"Students 330.0 395.0"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"lpsc_virtual_df = lpsc_df[1]\n",
"lpsc_virtual_df.columns = ['kind','early','standard','']\n",
"lpsc_virtual_df = lpsc_virtual_df.drop(index=[0,3],columns=[lpsc_virtual_df.columns[-1]])\n",
"lpsc_virtual_df.set_index('kind',inplace=True)\n",
"lpsc_virtual_df = lpsc_virtual_df.applymap(lambda x: float(x[1:]))\n",
"lpsc_virtual_df"
]
},
{
"cell_type": "code",
"execution_count": 95,
"id": "998bf8c0-3946-4215-a9e2-351193bab27b",
"metadata": {
"execution": {
"iopub.execute_input": "2022-02-18T14:16:26.906855Z",
"iopub.status.busy": "2022-02-18T14:16:26.906615Z",
"iopub.status.idle": "2022-02-18T14:16:26.915886Z",
"shell.execute_reply": "2022-02-18T14:16:26.915424Z",
"shell.execute_reply.started": "2022-02-18T14:16:26.906832Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Virtual/In-person attendance fee ratio average 73.4%\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>early</th>\n",
" <th>standard</th>\n",
" </tr>\n",
" <tr>\n",
" <th>kind</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Professionals</th>\n",
" <td>73.5</td>\n",
" <td>74.6</td>\n",
" </tr>\n",
" <tr>\n",
" <th>Students</th>\n",
" <td>68.0</td>\n",
" <td>77.5</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" early standard\n",
"kind \n",
"Professionals 73.5 74.6\n",
"Students 68.0 77.5"
]
},
"execution_count": 95,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pd.set_option('display.precision',1)\n",
"np.set_printoptions(precision=1)\n",
"print(f'Virtual/In-person attendance fee ratio average {100*(lpsc_virtual_df/lpsc_inperson_df).mean().mean():.1f}%')\n",
"100*(lpsc_virtual_df/lpsc_inperson_df)\n"
]
},
{
"cell_type": "code",
"execution_count": 94,
"id": "28a5b7a6-f926-4b51-8686-e00f77ca0ae8",
"metadata": {
"execution": {
"iopub.execute_input": "2022-02-18T14:16:14.170317Z",
"iopub.status.busy": "2022-02-18T14:16:14.170045Z",
"iopub.status.idle": "2022-02-18T14:16:14.180956Z",
"shell.execute_reply": "2022-02-18T14:16:14.180312Z",
"shell.execute_reply.started": "2022-02-18T14:16:14.170293Z"
},
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Students/Professionals attendance fee ratio, average 81.16%\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>early</th>\n",
" <th>standard</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>in-person</th>\n",
" <td>82.9</td>\n",
" <td>81.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>virtual</th>\n",
" <td>76.7</td>\n",
" <td>84.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" early standard\n",
"in-person 82.9 81.0\n",
"virtual 76.7 84.0"
]
},
"execution_count": 94,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# print('Students/Professionals In-Person attendance fee in %')\n",
"lpsc_student_vs_pro = pd.DataFrame([\n",
" lpsc_inperson_df.loc['Students']/lpsc_inperson_df.loc['Professionals'],\n",
" lpsc_virtual_df.loc['Students']/lpsc_virtual_df.loc['Professionals']\n",
"],index = ['in-person','virtual'])\n",
"print(f'Students/Professionals attendance fee ratio, average {100*lpsc_student_vs_pro.mean().mean():.1f}%')\n",
"\n",
"100*lpsc_student_vs_pro"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"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.9.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment