{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "## Title: Evaluating Equity and Impact\n", "### Author: David P. Adams\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Collecting pandas\n", " Using cached pandas-2.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (89 kB)\n", "Collecting numpy\n", " Using cached numpy-2.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)\n", "Collecting matplotlib\n", " Using cached matplotlib-3.9.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (11 kB)\n", "Collecting seaborn\n", " Using cached seaborn-0.13.2-py3-none-any.whl.metadata (5.4 kB)\n", "Requirement already satisfied: python-dateutil>=2.8.2 in /home/dadams/CSU Fullerton Dropbox/David Adams/Research Projects/California Equity/california_equity_git/.venv/lib/python3.12/site-packages (from pandas) (2.9.0.post0)\n", "Collecting pytz>=2020.1 (from pandas)\n", " Using cached pytz-2024.2-py2.py3-none-any.whl.metadata (22 kB)\n", "Collecting tzdata>=2022.7 (from pandas)\n", " Downloading tzdata-2024.2-py2.py3-none-any.whl.metadata (1.4 kB)\n", "Collecting contourpy>=1.0.1 (from matplotlib)\n", " Using cached contourpy-1.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.4 kB)\n", "Collecting cycler>=0.10 (from matplotlib)\n", " Using cached cycler-0.12.1-py3-none-any.whl.metadata (3.8 kB)\n", "Collecting fonttools>=4.22.0 (from matplotlib)\n", " Downloading fonttools-4.54.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (163 kB)\n", "Collecting kiwisolver>=1.3.1 (from matplotlib)\n", " Using cached kiwisolver-1.4.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.3 kB)\n", "Requirement already satisfied: packaging>=20.0 in /home/dadams/CSU Fullerton Dropbox/David Adams/Research Projects/California Equity/california_equity_git/.venv/lib/python3.12/site-packages (from matplotlib) (24.1)\n", "Collecting pillow>=8 (from matplotlib)\n", " Using cached pillow-10.4.0-cp312-cp312-manylinux_2_28_x86_64.whl.metadata (9.2 kB)\n", "Collecting pyparsing>=2.3.1 (from matplotlib)\n", " Using cached pyparsing-3.1.4-py3-none-any.whl.metadata (5.1 kB)\n", "Requirement already satisfied: six>=1.5 in /home/dadams/CSU Fullerton Dropbox/David Adams/Research Projects/California Equity/california_equity_git/.venv/lib/python3.12/site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)\n", "Using cached pandas-2.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.7 MB)\n", "Using cached numpy-2.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.0 MB)\n", "Using cached matplotlib-3.9.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.3 MB)\n", "Using cached seaborn-0.13.2-py3-none-any.whl (294 kB)\n", "Using cached contourpy-1.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (320 kB)\n", "Using cached cycler-0.12.1-py3-none-any.whl (8.3 kB)\n", "Downloading fonttools-4.54.1-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.9 MB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m4.9/4.9 MB\u001b[0m \u001b[31m34.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hUsing cached kiwisolver-1.4.7-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB)\n", "Using cached pillow-10.4.0-cp312-cp312-manylinux_2_28_x86_64.whl (4.5 MB)\n", "Using cached pyparsing-3.1.4-py3-none-any.whl (104 kB)\n", "Using cached pytz-2024.2-py2.py3-none-any.whl (508 kB)\n", "Downloading tzdata-2024.2-py2.py3-none-any.whl (346 kB)\n", "Installing collected packages: pytz, tzdata, pyparsing, pillow, numpy, kiwisolver, fonttools, cycler, pandas, contourpy, matplotlib, seaborn\n", "Successfully installed contourpy-1.3.0 cycler-0.12.1 fonttools-4.54.1 kiwisolver-1.4.7 matplotlib-3.9.2 numpy-2.1.1 pandas-2.2.3 pillow-10.4.0 pyparsing-3.1.4 pytz-2024.2 seaborn-0.13.2 tzdata-2024.2\n", "Note: you may need to restart the kernel to use updated packages.\n" ] } ], "source": [ "%pip install pandas numpy matplotlib seaborn\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "## set directory\n", "import os\n", "os.chdir('/home/dadams/Repos/California Equity/calif_equity_analysis')" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "# read in the data\n", "data = pd.read_csv('data_raw/cci_programs_data.csv', low_memory=False)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "\n", "columns_data = pd.DataFrame(data.columns)\n", "\n", "# export the 'DataFrame' to a csv file\n", "columns_data.to_csv('data_raw/columns.csv', index=False)\n" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "# check the data types\n", "data.dtypes\n", "\n", "# save the data types to a csv file\n", "data.dtypes.to_csv('data_raw/data_types.csv', header = False)\n", "\n" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | Census Tract | \n", "Total Project Cost | \n", "Total Program GGRFFunding | \n", "Total Project GHGReductions | \n", "Annual Project GHGReductions | \n", "Project Count | \n", "Total GGRFDisadvantaged Community Funding | \n", "Funding Benefiting Disadvantaged Communities | \n", "Estimated Num Vehicles In Service | \n", "Funding Within Disadvantage Communities | \n", "... | \n", "Indirect Jobs Fte | \n", "Induced Jobs Fte | \n", "Compost Produced Tons | \n", "Compost Produced Tons Yr | \n", "Net Density DUA | \n", "Applicants Assisted | \n", "Invasive Cover 12 Months | \n", "Invasive Cover 36 Months | \n", "Project Acreage | \n", "Intermediary Admin Expenses Calc | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| count | \n", "1.193700e+05 | \n", "1.414290e+05 | \n", "1.414290e+05 | \n", "1.414290e+05 | \n", "141429.000000 | \n", "141429.000000 | \n", "5.518700e+04 | \n", "55187.000000 | \n", "141429.000000 | \n", "5.518700e+04 | \n", "... | \n", "141429.000000 | \n", "141429.000000 | \n", "141429.000000 | \n", "141429.0 | \n", "141429.000000 | \n", "141429.000000 | \n", "141429.000000 | \n", "141429.000000 | \n", "1.414290e+05 | \n", "1.414290e+05 | \n", "
| mean | \n", "6.053889e+09 | \n", "9.206412e+05 | \n", "7.791664e+04 | \n", "7.717972e+02 | \n", "0.205389 | \n", "4.090872 | \n", "2.736820e+04 | \n", "110.217551 | \n", "0.047331 | \n", "2.030028e+04 | \n", "... | \n", "0.064567 | \n", "0.117056 | \n", "0.440977 | \n", "0.0 | \n", "0.082260 | \n", "0.019642 | \n", "0.010656 | \n", "0.010578 | \n", "9.771087e+00 | \n", "1.911114e+03 | \n", "
| std | \n", "2.641870e+07 | \n", "3.736191e+07 | \n", "1.011645e+06 | \n", "2.371604e+04 | \n", "3.361723 | \n", "18.381861 | \n", "6.327936e+05 | \n", "1738.772195 | \n", "1.972262 | \n", "5.590536e+05 | \n", "... | \n", "1.444316 | \n", "2.261146 | \n", "45.712955 | \n", "0.0 | \n", "4.382593 | \n", "1.406914 | \n", "0.758250 | \n", "0.757677 | \n", "3.669526e+03 | \n", "1.196317e+05 | \n", "
| min | \n", "6.001400e+09 | \n", "0.000000e+00 | \n", "0.000000e+00 | \n", "-2.785930e+05 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000e+00 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000e+00 | \n", "... | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.0 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000e+00 | \n", "0.000000e+00 | \n", "
| 25% | \n", "6.037271e+09 | \n", "4.000000e+03 | \n", "3.500000e+03 | \n", "8.000000e+00 | \n", "0.000000 | \n", "1.000000 | \n", "0.000000e+00 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000e+00 | \n", "... | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.0 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000e+00 | \n", "0.000000e+00 | \n", "
| 50% | \n", "6.059022e+09 | \n", "8.000000e+03 | \n", "7.500000e+03 | \n", "1.500000e+01 | \n", "0.000000 | \n", "1.000000 | \n", "0.000000e+00 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000e+00 | \n", "... | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.0 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000e+00 | \n", "0.000000e+00 | \n", "
| 75% | \n", "6.073016e+09 | \n", "2.150000e+04 | \n", "1.900000e+04 | \n", "4.000000e+01 | \n", "0.000000 | \n", "3.000000 | \n", "5.500000e+03 | \n", "0.000000 | \n", "0.000000 | \n", "1.500000e+03 | \n", "... | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.0 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000 | \n", "0.000000e+00 | \n", "0.000000e+00 | \n", "
| max | \n", "6.115041e+09 | \n", "5.767700e+09 | \n", "1.412670e+08 | \n", "4.748924e+06 | \n", "336.000000 | \n", "2072.000000 | \n", "6.443700e+07 | \n", "102348.000000 | \n", "503.000000 | \n", "6.443700e+07 | \n", "... | \n", "110.170000 | \n", "151.000000 | \n", "10365.000000 | \n", "0.0 | \n", "706.000000 | \n", "320.000000 | \n", "85.000000 | \n", "85.000000 | \n", "1.380000e+06 | \n", "2.000000e+07 | \n", "
8 rows × 82 columns
\n", "