Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Run tests

on: push

jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v6
# https://github.com/actions/setup-python
- name: Install Python
uses: actions/setup-python@v6
with:
python-version: "3.14"
cache: pip
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests
# https://pytest-cov.readthedocs.io/en/latest/readme.html
run: pytest --cov

# https://github.com/astral-sh/ruff-action
- name: Set up ruff
uses: astral-sh/ruff-action@v3
with:
version: latest
- name: Lint
run: ruff check
- name: Check formatting
run: ruff format --check
65 changes: 48 additions & 17 deletions mta_ridership_project .ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@
"**Dataset:** MTA Daily Ridership Data: Beginning 2020\n",
"\n",
"**Research Questions:**\n",
"\n",
"1. What's the difference between weekday and weekend travel patterns?\n",
"2. Do holidays and big events show up in the ridership numbers?\n",
"3. Which parts of the MTA system bounced back fastest after 2020?"
"3. Which parts of the MTA system bounced back fastest after 2020?\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. Setup and Data Loading"
"## 1. Setup and Data Loading\n"
]
},
{
Expand All @@ -44,7 +45,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. Data Cleaning"
"## 2. Data Cleaning\n"
]
},
{
Expand All @@ -65,7 +66,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. Visualization: MTA Ridership Recovery by Transit Mode"
"## 3. Visualization: MTA Ridership Recovery by Transit Mode\n"
]
},
{
Expand All @@ -76,21 +77,51 @@
"source": [
"plt.figure(figsize=(14, 7))\n",
"\n",
"plt.plot(df['date'], df['subways_of_comparable_pre_pandemic_day'], \n",
" label='Subway', alpha=0.8, linewidth=1.2)\n",
"plt.plot(df['date'], df['buses_of_comparable_pre_pandemic_day'], \n",
" label='Bus', alpha=0.8, linewidth=1.2)\n",
"plt.plot(df['date'], df['lirr_of_comparable_pre_pandemic_day'], \n",
" label='LIRR', alpha=0.8, linewidth=1.2)\n",
"plt.plot(df['date'], df['metro_north_of_comparable_pre_pandemic_day'], \n",
" label='Metro-North', alpha=0.8, linewidth=1.2)\n",
"plt.plot(\n",
" df[\"date\"],\n",
" df[\"subways_of_comparable_pre_pandemic_day\"],\n",
" label=\"Subway\",\n",
" alpha=0.8,\n",
" linewidth=1.2,\n",
")\n",
"plt.plot(\n",
" df[\"date\"],\n",
" df[\"buses_of_comparable_pre_pandemic_day\"],\n",
" label=\"Bus\",\n",
" alpha=0.8,\n",
" linewidth=1.2,\n",
")\n",
"plt.plot(\n",
" df[\"date\"],\n",
" df[\"lirr_of_comparable_pre_pandemic_day\"],\n",
" label=\"LIRR\",\n",
" alpha=0.8,\n",
" linewidth=1.2,\n",
")\n",
"plt.plot(\n",
" df[\"date\"],\n",
" df[\"metro_north_of_comparable_pre_pandemic_day\"],\n",
" label=\"Metro-North\",\n",
" alpha=0.8,\n",
" linewidth=1.2,\n",
")\n",
"\n",
"plt.axhline(y=1.0, color='gray', linestyle='--', linewidth=1.5, label='Pre-pandemic baseline (100%)')\n",
"plt.axhline(\n",
" y=1.0,\n",
" color=\"gray\",\n",
" linestyle=\"--\",\n",
" linewidth=1.5,\n",
" label=\"Pre-pandemic baseline (100%)\",\n",
")\n",
"\n",
"plt.xlabel('Date', fontsize=12)\n",
"plt.ylabel('% of Pre-Pandemic Ridership', fontsize=12)\n",
"plt.title('MTA Ridership Recovery: Subway vs Bus vs Commuter Rail (2020-Present)', fontsize=14, fontweight='bold')\n",
"plt.legend(loc='lower right', fontsize=10)\n",
"plt.xlabel(\"Date\", fontsize=12)\n",
"plt.ylabel(\"% of Pre-Pandemic Ridership\", fontsize=12)\n",
"plt.title(\n",
" \"MTA Ridership Recovery: Subway vs Bus vs Commuter Rail (2020-Present)\",\n",
" fontsize=14,\n",
" fontweight=\"bold\",\n",
")\n",
"plt.legend(loc=\"lower right\", fontsize=10)\n",
"plt.grid(True, alpha=0.3)\n",
"plt.ylim(0, 1.5)\n",
"plt.tight_layout()\n",
Expand Down
5 changes: 4 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
streamlit
pandas
plotly
requests
requests
pytest
pytest-cov
matplotlib
Loading