diff --git a/FP_Notebook.ipynb b/FP_Notebook.ipynb index eb4238a..579a3a4 100644 --- a/FP_Notebook.ipynb +++ b/FP_Notebook.ipynb @@ -9,33 +9,15 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 2, "metadata": {}, - "outputs": [ - { - "ename": "FileNotFoundError", - "evalue": "[Errno 2] No such file or directory: 'parks.csv'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mFileNotFoundError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mget_ipython\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrun_line_magic\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'matplotlib'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'inline'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mmatplotlib\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpyplot\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0mparks_pandas\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_csv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"parks.csv\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindex_col\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"id\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0mgreenspaces_pandas\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_csv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"green_spaces.csv\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0mplaygrounds_pandas\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_csv\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"playgrounds.csv\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mindex_col\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"id\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/tljh/user/lib/python3.8/site-packages/pandas/util/_decorators.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 309\u001b[0m \u001b[0mstacklevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstacklevel\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 310\u001b[0m )\n\u001b[0;32m--> 311\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 312\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 313\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/tljh/user/lib/python3.8/site-packages/pandas/io/parsers/readers.py\u001b[0m in \u001b[0;36mread_csv\u001b[0;34m(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, error_bad_lines, warn_bad_lines, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options)\u001b[0m\n\u001b[1;32m 678\u001b[0m \u001b[0mkwds\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mupdate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkwds_defaults\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 679\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 680\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0m_read\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilepath_or_buffer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mkwds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 681\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 682\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/tljh/user/lib/python3.8/site-packages/pandas/io/parsers/readers.py\u001b[0m in \u001b[0;36m_read\u001b[0;34m(filepath_or_buffer, kwds)\u001b[0m\n\u001b[1;32m 573\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 574\u001b[0m \u001b[0;31m# Create the parser.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 575\u001b[0;31m \u001b[0mparser\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mTextFileReader\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfilepath_or_buffer\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 576\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 577\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mchunksize\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0miterator\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/tljh/user/lib/python3.8/site-packages/pandas/io/parsers/readers.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, f, engine, **kwds)\u001b[0m\n\u001b[1;32m 931\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 932\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhandles\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mIOHandles\u001b[0m \u001b[0;34m|\u001b[0m \u001b[0;32mNone\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 933\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_engine\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_make_engine\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mengine\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 934\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 935\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mclose\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/tljh/user/lib/python3.8/site-packages/pandas/io/parsers/readers.py\u001b[0m in \u001b[0;36m_make_engine\u001b[0;34m(self, f, engine)\u001b[0m\n\u001b[1;32m 1215\u001b[0m \u001b[0;31m# \"Union[str, PathLike[str], ReadCsvBuffer[bytes], ReadCsvBuffer[str]]\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1216\u001b[0m \u001b[0;31m# , \"str\", \"bool\", \"Any\", \"Any\", \"Any\", \"Any\", \"Any\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1217\u001b[0;31m self.handles = get_handle( # type: ignore[call-overload]\n\u001b[0m\u001b[1;32m 1218\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1219\u001b[0m \u001b[0mmode\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/tljh/user/lib/python3.8/site-packages/pandas/io/common.py\u001b[0m in \u001b[0;36mget_handle\u001b[0;34m(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)\u001b[0m\n\u001b[1;32m 787\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mioargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mencoding\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;34m\"b\"\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mioargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmode\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 788\u001b[0m \u001b[0;31m# Encoding\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 789\u001b[0;31m handle = open(\n\u001b[0m\u001b[1;32m 790\u001b[0m \u001b[0mhandle\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 791\u001b[0m \u001b[0mioargs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmode\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mFileNotFoundError\u001b[0m: [Errno 2] No such file or directory: 'parks.csv'" - ] - } - ], + "outputs": [], "source": [ "import pandas as pd\n", "import numpy as np\n", "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", - "parks_pandas = pd.read_csv(\"parks.csv\", index_col=\"id\")\n", + "parks_pandas = pd.read_csv(\"courts.csv\", index_col=\"id\")\n", "greenspaces_pandas = pd.read_csv(\"green_spaces.csv\")\n", "playgrounds_pandas = pd.read_csv(\"playgrounds.csv\", index_col=\"id\")" ] @@ -746,13 +728,6 @@ "source": [ "I'm not too familiar with the neighborhoods of Pittsburgh, so if I had to pick my favorite neighborhood, it would be Central Oakland. Based on our metric of choosing the best neighborhood to have fun outside in, I think Central Oakland could still work. This is mainly because of Schenley Park, however I think some of the park bleeds into Squirrel Hill South, which is our winning \"best neighborhood.\"" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": { diff --git a/GreenSpaces_Notebook.ipynb b/GreenSpaces_Notebook.ipynb index 34e27df..302d233 100644 --- a/GreenSpaces_Notebook.ipynb +++ b/GreenSpaces_Notebook.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Introduction

" + "

Introduction" ] }, { @@ -18,7 +18,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Importing Pandas and MatPlotLib

" + "

Importing Pandas and MatPlotLib" ] }, { @@ -38,7 +38,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Establishing Data

" + "

Establishing Data" ] }, { @@ -284,7 +284,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Cleaning up the data

" + "

Cleaning up the data" ] }, { @@ -377,7 +377,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Found Neighborhood with the most Green Spaces

" + "

Found Neighborhood with the most Green Spaces" ] }, { @@ -507,7 +507,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Plotting the data

" + "

Plotting the data" ] }, { @@ -553,248 +553,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "

Mapping out the data

\n", - "Here I created a map to visualize the neighborhoods with the most green spaces and their locations within the city of Pittsburgh." - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "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", - "
objectidfid_blockgstatefp10countyfp10tractce10blkgrpce10geoid10namelsad10mtfcc10funcstat10...page_numberplannerassignglobalidcreated_usercreated_datelast_edited_userlast_edited_datetempshape_areashape_length
01233420031405003420031405003Block Group 3G5030S...15Ose Akinlotana642a6b6-a2a9-48d5-acf2-3e2ce87d4bc0SDE2020-08-14T12:57:28SDE2020-08-14T13:02:13NaN8.153647e+0614047.065024
12203420031401003420031401003Block Group 3G5030S...15Ose Akinlotan20d4605b-258e-441a-a57e-a28fdabb6d30SDE2020-08-14T12:57:28SDE2020-08-14T13:02:41NaN3.407739e+0730347.886823
2386420031017002420031017002Block Group 2G5030S...15Ose Akinlotanbf4065e7-c29c-48bd-b529-e7fd99077238SDE2020-08-14T12:57:28SDE2020-08-14T12:59:55NaN1.275116e+0714577.441571
34214420030509001420030509001Block Group 1G5030S...15Ose Akinlotanfed3fb32-0cd3-4556-aa41-17ee03b4fe41SDE2020-08-14T12:57:28SDE2020-08-14T12:58:41NaN4.997845e+0614216.959213
45173420033001005420033001005Block Group 5G5030S...15Thomas Scharff8669d2f0-b886-4519-99d0-bb1015b592b0SDE2020-08-14T12:57:28SDE2020-08-14T13:00:19NaN8.410563e+0612003.269761
\n", - "

5 rows × 39 columns

\n", - "
" - ], - "text/plain": [ - " objectid fid_blockg statefp10 countyfp10 tractce10 blkgrpce10 \\\n", - "0 1 233 42 003 140500 3 \n", - "1 2 203 42 003 140100 3 \n", - "2 3 86 42 003 101700 2 \n", - "3 4 214 42 003 050900 1 \n", - "4 5 173 42 003 300100 5 \n", - "\n", - " geoid10 namelsad10 mtfcc10 funcstat10 ... page_number \\\n", - "0 420031405003 Block Group 3 G5030 S ... 15 \n", - "1 420031401003 Block Group 3 G5030 S ... 15 \n", - "2 420031017002 Block Group 2 G5030 S ... 15 \n", - "3 420030509001 Block Group 1 G5030 S ... 15 \n", - "4 420033001005 Block Group 5 G5030 S ... 15 \n", - "\n", - " plannerassign globalid created_user \\\n", - "0 Ose Akinlotan a642a6b6-a2a9-48d5-acf2-3e2ce87d4bc0 SDE \n", - "1 Ose Akinlotan 20d4605b-258e-441a-a57e-a28fdabb6d30 SDE \n", - "2 Ose Akinlotan bf4065e7-c29c-48bd-b529-e7fd99077238 SDE \n", - "3 Ose Akinlotan fed3fb32-0cd3-4556-aa41-17ee03b4fe41 SDE \n", - "4 Thomas Scharff 8669d2f0-b886-4519-99d0-bb1015b592b0 SDE \n", - "\n", - " created_date last_edited_user last_edited_date temp \\\n", - "0 2020-08-14T12:57:28 SDE 2020-08-14T13:02:13 NaN \n", - "1 2020-08-14T12:57:28 SDE 2020-08-14T13:02:41 NaN \n", - "2 2020-08-14T12:57:28 SDE 2020-08-14T12:59:55 NaN \n", - "3 2020-08-14T12:57:28 SDE 2020-08-14T12:58:41 NaN \n", - "4 2020-08-14T12:57:28 SDE 2020-08-14T13:00:19 NaN \n", - "\n", - " shape_area shape_length \n", - "0 8.153647e+06 14047.065024 \n", - "1 3.407739e+07 30347.886823 \n", - "2 1.275116e+07 14577.441571 \n", - "3 4.997845e+06 14216.959213 \n", - "4 8.410563e+06 12003.269761 \n", - "\n", - "[5 rows x 39 columns]" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "neighborhoods = pd.read_csv(\"neighborhoods.csv\")\n", - "neighborhoods.head()" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Here I am taking that dataset, and turning it into a map of Pittsburgh to later on visualize all of the green spaces in the city of Pittsburgh." + "

Results and Conclusion" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "

Results and Conclusion

\n", - " \n", - "

In the bar graph, I found East Liberty to be the best neighborhood for the amount of green spaces. However, in order to check with the other metrics to find the top neighborhood, I have nominated the top 8 neighborhoods in the graph as well to account for the number of neighborhoods that have green spaces.
\n", + "In the bar graph, I found **East Liberty** to be the best neighborhood for the amount of green spaces. However, in order to check with the other metrics to find the top neighborhood, I have nominated the top 8 neighborhoods in the graph as well to account for the number of neighborhoods that have green spaces.\n", " \n", " 1. East Liberty\n", " 2. Point Breeze\n", @@ -805,13 +571,6 @@ " 7. Squirrel Hill South\n", " 8. Swisshelm Park" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {