diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..722343e Binary files /dev/null and b/.DS_Store differ diff --git a/your-project/.DS_Store b/your-project/.DS_Store new file mode 100644 index 0000000..3ac9996 Binary files /dev/null and b/your-project/.DS_Store differ diff --git a/your-project/.ipynb_checkpoints/Pandas - Population PCT Change -checkpoint.ipynb b/your-project/.ipynb_checkpoints/Pandas - Population PCT Change -checkpoint.ipynb new file mode 100644 index 0000000..2fd6442 --- /dev/null +++ b/your-project/.ipynb_checkpoints/Pandas - Population PCT Change -checkpoint.ipynb @@ -0,0 +1,6 @@ +{ + "cells": [], + "metadata": {}, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/your-project/Gareth_MySQL_Notebooks/Pandas - Population PCT Change .ipynb b/your-project/Gareth_MySQL_Notebooks/Pandas - Population PCT Change .ipynb new file mode 100644 index 0000000..56d09c6 --- /dev/null +++ b/your-project/Gareth_MySQL_Notebooks/Pandas - Population PCT Change .ipynb @@ -0,0 +1,540 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "population = pd.read_csv('/Users/garethhughes/Desktop/Ironhack/Week_Two/Project-Week-2-Barcelona/datasets/3.-Population/population.csv')" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "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", + "
YearDistrict.CodeDistrict.NameNeighborhood.CodeNeighborhood.NameGenderAgeNumber
020171Ciutat Vella1el RavalMale0-4224
120171Ciutat Vella2el Barri GòticMale0-450
220171Ciutat Vella3la BarcelonetaMale0-443
320171Ciutat Vella4Sant Pere, Santa Caterina i la RiberaMale0-495
420172Eixample5el Fort PiencMale0-4124
\n", + "
" + ], + "text/plain": [ + " Year District.Code District.Name Neighborhood.Code \\\n", + "0 2017 1 Ciutat Vella 1 \n", + "1 2017 1 Ciutat Vella 2 \n", + "2 2017 1 Ciutat Vella 3 \n", + "3 2017 1 Ciutat Vella 4 \n", + "4 2017 2 Eixample 5 \n", + "\n", + " Neighborhood.Name Gender Age Number \n", + "0 el Raval Male 0-4 224 \n", + "1 el Barri Gòtic Male 0-4 50 \n", + "2 la Barceloneta Male 0-4 43 \n", + "3 Sant Pere, Santa Caterina i la Ribera Male 0-4 95 \n", + "4 el Fort Pienc Male 0-4 124 " + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "population.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 138, + "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", + "
YearAgeNumber
020130-469267
1201310-1462566
2201315-1963540
3201320-2478485
4201325-29110563
............
95201775-7959962
96201780-8459453
97201785-8941136
98201790-9419016
992017>=955415
\n", + "

100 rows × 3 columns

\n", + "
" + ], + "text/plain": [ + " Year Age Number\n", + "0 2013 0-4 69267\n", + "1 2013 10-14 62566\n", + "2 2013 15-19 63540\n", + "3 2013 20-24 78485\n", + "4 2013 25-29 110563\n", + ".. ... ... ...\n", + "95 2017 75-79 59962\n", + "96 2017 80-84 59453\n", + "97 2017 85-89 41136\n", + "98 2017 90-94 19016\n", + "99 2017 >=95 5415\n", + "\n", + "[100 rows x 3 columns]" + ] + }, + "execution_count": 138, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "year_age_number = population.groupby(['Year','Age'],as_index=False).sum().drop(columns = ['District.Code','Neighborhood.Code'])\n", + "year_age_number" + ] + }, + { + "cell_type": "code", + "execution_count": 95, + "metadata": {}, + "outputs": [], + "source": [ + "year_age_number.set_index('Year',inplace=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 96, + "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", + "
AgeNumberNumber_PCT
Year
20130-469267NaN
201310-1462566-0.096742
201315-19635400.015568
201320-24784850.235206
201325-291105630.408715
\n", + "
" + ], + "text/plain": [ + " Age Number Number_PCT\n", + "Year \n", + "2013 0-4 69267 NaN\n", + "2013 10-14 62566 -0.096742\n", + "2013 15-19 63540 0.015568\n", + "2013 20-24 78485 0.235206\n", + "2013 25-29 110563 0.408715" + ] + }, + "execution_count": 96, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "year_age_number.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 189, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/local/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:5: SettingWithCopyWarning: \n", + "A value is trying to be set on a copy of a slice from a DataFrame.\n", + "Try using .loc[row_indexer,col_indexer] = value instead\n", + "\n", + "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", + " \"\"\"\n" + ] + }, + { + "ename": "KeyError", + "evalue": "'Number'", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/usr/local/anaconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mget_loc\u001b[0;34m(self, key, method, tolerance)\u001b[0m\n\u001b[1;32m 2896\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2897\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\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 2898\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32mpandas/_libs/index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n", + "\u001b[0;32mpandas/_libs/index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n", + "\u001b[0;32mpandas/_libs/hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n", + "\u001b[0;32mpandas/_libs/hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n", + "\u001b[0;31mKeyError\u001b[0m: 'Number'", + "\nDuring handling of the above exception, another exception occurred:\n", + "\u001b[0;31mKeyError\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 5\u001b[0m \u001b[0mmetric2013\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Number_2017'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmetric2017\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Number'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvalues\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 7\u001b[0;31m final_table['Number_PCT_Change'] = (((final_table['Number']-final_table['Number_2017'])/\n\u001b[0m\u001b[1;32m 8\u001b[0m final_table['Number'])*100)\n\u001b[1;32m 9\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/local/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36m__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 2978\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mnlevels\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2979\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_getitem_multilevel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2980\u001b[0;31m \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\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 2981\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mis_integer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindexer\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[1;32m 2982\u001b[0m \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/local/anaconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mget_loc\u001b[0;34m(self, key, method, tolerance)\u001b[0m\n\u001b[1;32m 2897\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2898\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2899\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_engine\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_loc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_maybe_cast_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mkey\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[0m\u001b[1;32m 2900\u001b[0m \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_indexer\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmethod\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmethod\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtolerance\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mtolerance\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2901\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mindexer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mndim\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0;36m1\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mindexer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msize\u001b[0m \u001b[0;34m>\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32mpandas/_libs/index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n", + "\u001b[0;32mpandas/_libs/index.pyx\u001b[0m in \u001b[0;36mpandas._libs.index.IndexEngine.get_loc\u001b[0;34m()\u001b[0m\n", + "\u001b[0;32mpandas/_libs/hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n", + "\u001b[0;32mpandas/_libs/hashtable_class_helper.pxi\u001b[0m in \u001b[0;36mpandas._libs.hashtable.PyObjectHashTable.get_item\u001b[0;34m()\u001b[0m\n", + "\u001b[0;31mKeyError\u001b[0m: 'Number'" + ] + } + ], + "source": [ + "metric2013 = year_age_number[year_age_number['Year'] == 2013]\n", + "\n", + "metric2017 = year_age_number[year_age_number['Year'] == 2017]\n", + "\n", + "\n", + "final_table['Number_PCT_Change'] = (((final_table['Number']-final_table['Number_2017'])/\n", + " final_table['Number'])*100)\n", + "\n", + "final_table\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Age\n", + "0-4 15.208186\n", + "10-14 -0.012090\n", + "15-19 0.015568\n", + "20-24 0.235206\n", + "25-29 0.408715\n", + "30-34 0.253861\n", + "35-39 0.108077\n", + "40-44 -0.007565\n", + "45-49 -0.062600\n", + "5-9 -0.413529\n", + "50-54 0.630971\n", + "55-59 -0.086194\n", + "60-64 -0.048630\n", + "65-69 0.001018\n", + "70-74 -0.101584\n", + "75-79 0.067019\n", + "80-84 -0.005155\n", + "85-89 -0.308092\n", + "90-94 -0.537729\n", + ">=95 -0.715240\n", + "Name: Number_PCT, dtype: float64" + ] + }, + "execution_count": 71, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "seventy = " + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Age\n", + "0-4 12.571825\n", + "10-14 -0.096742\n", + "15-19 -0.024003\n", + "20-24 0.198551\n", + "25-29 0.334160\n", + "30-34 0.148973\n", + "35-39 0.031288\n", + "40-44 -0.121430\n", + "45-49 -0.113996\n", + "5-9 -0.425946\n", + "50-54 0.579481\n", + "55-59 -0.108458\n", + "60-64 -0.124427\n", + "65-69 -0.054363\n", + "70-74 -0.235721\n", + "75-79 -0.226307\n", + "80-84 -0.152103\n", + "85-89 -0.363376\n", + "90-94 -0.593586\n", + ">=95 -0.729765\n", + "Name: Number_PCT, dtype: float64" + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "year_age_number.groupby(['Age'])['Number_PCT'].min()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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.7.4" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/your-project/Gareth_MySQL_Notebooks/Question 6 - Overall Demographics b/your-project/Gareth_MySQL_Notebooks/Question 6 - Overall Demographics new file mode 100644 index 0000000..c5ed3ab --- /dev/null +++ b/your-project/Gareth_MySQL_Notebooks/Question 6 - Overall Demographics @@ -0,0 +1,21 @@ +Age,sum(Number) +35-39,695727 +40-44,646874 +30-34,643898 +45-49,587788 +50-54,550379 +25-29,528625 +55-59,498789 +60-64,449216 +65-69,436198 +20-24,388085 +70-74,363660 +0-4,343517 +5-9,342661 +10-14,323956 +15-19,320334 +75-79,319885 +80-84,300115 +85-89,197926 +90-94,86740 +>=95,23945 diff --git a/your-project/Gareth_MySQL_Notebooks/Question 6 - Overall Demographics.sql b/your-project/Gareth_MySQL_Notebooks/Question 6 - Overall Demographics.sql new file mode 100644 index 0000000..88e6551 --- /dev/null +++ b/your-project/Gareth_MySQL_Notebooks/Question 6 - Overall Demographics.sql @@ -0,0 +1,8 @@ +SELECT + Age, sum(Number) +FROM + population +GROUP BY + Age +ORDER BY + sum(Number) DESC; \ No newline at end of file diff --git a/your-project/Gareth_MySQL_Notebooks/Question 7 - Oldest People Live b/your-project/Gareth_MySQL_Notebooks/Question 7 - Oldest People Live new file mode 100644 index 0000000..9bf3050 --- /dev/null +++ b/your-project/Gareth_MySQL_Notebooks/Question 7 - Oldest People Live @@ -0,0 +1,11 @@ +District.Name,sum(Number),Age +Eixample,1275,>=95 +"Sarrià-Sant Gervasi",733,>=95 +"Sant Martí",560,>=95 +Horta-Guinardó,560,>=95 +Gràcia,513,>=95 +Sants-Montjuïc,466,>=95 +"Sant Andreu",391,>=95 +"Nou Barris",375,>=95 +"Les Corts",314,>=95 +"Ciutat Vella",228,>=95 diff --git a/your-project/Gareth_MySQL_Notebooks/Question 7 - Oldest People Live.sql b/your-project/Gareth_MySQL_Notebooks/Question 7 - Oldest People Live.sql new file mode 100644 index 0000000..b7577ec --- /dev/null +++ b/your-project/Gareth_MySQL_Notebooks/Question 7 - Oldest People Live.sql @@ -0,0 +1,11 @@ +SELECT + `District.Name`, sum(Number), Age +FROM + population +WHERE + Year = '2017' AND + Age = '>=95' +GROUP BY + `District.Name`, Age +ORDER BY + sum(Number) DESC; \ No newline at end of file diff --git a/your-project/Gareth_MySQL_Notebooks/Question 7b - Youngest People Live b/your-project/Gareth_MySQL_Notebooks/Question 7b - Youngest People Live new file mode 100644 index 0000000..817b5b0 --- /dev/null +++ b/your-project/Gareth_MySQL_Notebooks/Question 7b - Youngest People Live @@ -0,0 +1,11 @@ +District.Name,sum(Number),Age +"Sant Martí",10601,0-4 +Eixample,10285,0-4 +Sants-Montjuïc,7332,0-4 +"Nou Barris",7197,0-4 +"Sarrià-Sant Gervasi",7152,0-4 +Horta-Guinardó,6800,0-4 +"Sant Andreu",6576,0-4 +Gràcia,5196,0-4 +"Ciutat Vella",3855,0-4 +"Les Corts",3408,0-4 diff --git a/your-project/Gareth_MySQL_Notebooks/Question 7b - Youngest People Live.sql b/your-project/Gareth_MySQL_Notebooks/Question 7b - Youngest People Live.sql new file mode 100644 index 0000000..8ca5c25 --- /dev/null +++ b/your-project/Gareth_MySQL_Notebooks/Question 7b - Youngest People Live.sql @@ -0,0 +1,11 @@ +SELECT + `District.Name`, sum(Number), Age +FROM + population +WHERE + Year = '2017' AND + Age = '0-4' +GROUP BY + `District.Name`, Age +ORDER BY + sum(Number) DESC; \ No newline at end of file diff --git a/your-project/Gareth_MySQL_Notebooks/Question 7c - Oldest People Live 2014 b/your-project/Gareth_MySQL_Notebooks/Question 7c - Oldest People Live 2014 new file mode 100644 index 0000000..d7b3606 --- /dev/null +++ b/your-project/Gareth_MySQL_Notebooks/Question 7c - Oldest People Live 2014 @@ -0,0 +1,11 @@ +District.Name,sum(Number),Age +Eixample,1071,>=95 +"Sarrià-Sant Gervasi",582,>=95 +Gràcia,469,>=95 +Horta-Guinardó,466,>=95 +"Sant Martí",455,>=95 +Sants-Montjuïc,400,>=95 +"Sant Andreu",298,>=95 +"Nou Barris",281,>=95 +"Les Corts",242,>=95 +"Ciutat Vella",224,>=95 diff --git a/your-project/Gareth_MySQL_Notebooks/Question 7c - Oldest People Live 2014.sql b/your-project/Gareth_MySQL_Notebooks/Question 7c - Oldest People Live 2014.sql new file mode 100644 index 0000000..363bde4 --- /dev/null +++ b/your-project/Gareth_MySQL_Notebooks/Question 7c - Oldest People Live 2014.sql @@ -0,0 +1,11 @@ +SELECT + `District.Name`, sum(Number), Age +FROM + population +WHERE + Year = '2014' AND + Age = '>=95' +GROUP BY + `District.Name`, Age +ORDER BY + sum(Number) DESC; \ No newline at end of file diff --git a/your-project/Gareth_MySQL_Notebooks/Question 7d - Youngest People Live 2014 b/your-project/Gareth_MySQL_Notebooks/Question 7d - Youngest People Live 2014 new file mode 100644 index 0000000..ee929ea --- /dev/null +++ b/your-project/Gareth_MySQL_Notebooks/Question 7d - Youngest People Live 2014 @@ -0,0 +1,11 @@ +District.Name,sum(Number),Age +"Sant Martí",10817,0-4 +Eixample,10042,0-4 +Sants-Montjuïc,7395,0-4 +"Sarrià-Sant Gervasi",7291,0-4 +"Nou Barris",7255,0-4 +"Sant Andreu",6863,0-4 +Horta-Guinardó,6830,0-4 +Gràcia,5087,0-4 +"Ciutat Vella",4018,0-4 +"Les Corts",3303,0-4 diff --git a/your-project/Gareth_MySQL_Notebooks/Question 7d - Youngest People Live 2014.sql b/your-project/Gareth_MySQL_Notebooks/Question 7d - Youngest People Live 2014.sql new file mode 100644 index 0000000..38a210c --- /dev/null +++ b/your-project/Gareth_MySQL_Notebooks/Question 7d - Youngest People Live 2014.sql @@ -0,0 +1,11 @@ +SELECT + `District.Name`, sum(Number), Age +FROM + population +WHERE + Year = '2014' AND + Age = '0-4' +GROUP BY + `District.Name`, Age +ORDER BY + sum(Number) DESC; \ No newline at end of file diff --git a/your-project/README.md b/your-project/README.md index 0103b93..d39479f 100644 --- a/your-project/README.md +++ b/your-project/README.md @@ -1,9 +1,9 @@ Ironhack Logo -# Title of My Project -*[Your Name]* +# The Population of Barcelona +*Vicky Zauner & Gareth Hughes* -*[Your Cohort, Campus & Date]* +*[Data Analytics March 2020, Ironhack Barcelona, 10th April]* ## Content - [Project Description](#project-description) @@ -16,28 +16,49 @@ ## Project Description -Write a short introduction to your project: 3-5 sentences about the context of your topic and why you chose it. +Write a short introduction to your project: + +Our project was focused on investigating and answering questions regarding the population of Barcelona. +We were given a dataset which consisted of the number of people living in each Barrio (District) of Barcelona +and their gender and age group from 2013 to 2017. We, as a team, asked questions we found interesting and sought to answer them with MySQL and Pandas! ## Questions & Hypotheses What are the questions you would like to answer with your analysis? What did you feel were the answers to those questions before answering them with data? +Generally we wanted to ask questions with regards to how people were distributed across Barcelona in accordance to their age. Barcelona's districts +are typically known for either being family centric or party centric, so perhaps the demographic distribution might reflect that. +Also, we were interested in wherever we could see the effects of a global aging population with the changes in demographics over time. +We felt like those answers could definitely be obtained with the dataset. We predicted that areas such as Raval, Gotic and Born may have more party goers, +whilst areas like Sarria / Eixample might have more families. Additionally, we thought that the aging population would be reflected in the data. ## Dataset What dataset (or datasets) did you use? What is the source of your data? Provide links to the data if available and describe the data briefly. +We used the Population.csv. The source is from the Catalan Goverment. + ## Database What is the structure of your database? Have you created more than one table and if yes, how are they related to each other? Include a drawing or computer-generated image of the ERD (Entity Relationship Diagram) of your database. +Our database was based on a single CSV divided into columns that contained details regarding the District, Neighbourhoods, Gender, Number and Age Group of the entire city. + ## Workflow Outline the workflow you used in your project. What are the steps you went through? +Our workflow consisted of discussing the project and generating questions first handle based on a brief look at the data using MySQL Workbench. +Then, we distributed the questions into tasks for each person to complete. Once completed we met up, discussed our findings, did some more analysis and then +completed the presentation. + ## Organization How did you organize your work? Did you use any tools like a kanban board? +We used the Trello board, Google Slides and Zoom conferencing to discuss and coordinate our work. + What does your repository look like? Explain your folder and file structure. +The repository consists of the data files provided by Ironhack. We then divded up our SQL queries and outputs into seperate folders by branching with GitHub. + ## Links Include links to your repository, slides and kanban board. Feel free to include any other links associated with your project. -[Repository](https://github.com/) -[Slides](https://slides.com/) -[Trello](https://trello.com/en) +[Repository][Gareth's Github](https://github.com/peiriant) / [Vicky's Github](https://github.com/VickyZauner) +[Slides](https://docs.google.com/presentation/d/1WDBeeWpD6za2syDMQ1G0xq0Xw_AeZHo_HWFY5s6oIDs/edit?ts=5e8ebbd3#slide=id.p) +[Trello](https://trello.com/b/lxXG5Fxb/project-2-barcelona-gh) diff --git a/your-project/Vicky_MySQL/Project-Week2-Population of Barcelona.ipynb b/your-project/Vicky_MySQL/Project-Week2-Population of Barcelona.ipynb new file mode 100644 index 0000000..d7bd690 --- /dev/null +++ b/your-project/Vicky_MySQL/Project-Week2-Population of Barcelona.ipynb @@ -0,0 +1,1753 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Calculations and Analysis on the Population of Barcelona" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Importing Pandas and Numpy and the Data Set" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "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", + "
YearDistrict.CodeDistrict.NameNeighborhood.CodeNeighborhood.NameGenderAgeNumber
020171Ciutat Vella1el RavalMale0-4224
120171Ciutat Vella2el Barri GòticMale0-450
220171Ciutat Vella3la BarcelonetaMale0-443
320171Ciutat Vella4Sant Pere, Santa Caterina i la RiberaMale0-495
420172Eixample5el Fort PiencMale0-4124
\n", + "
" + ], + "text/plain": [ + " Year District.Code District.Name Neighborhood.Code \\\n", + "0 2017 1 Ciutat Vella 1 \n", + "1 2017 1 Ciutat Vella 2 \n", + "2 2017 1 Ciutat Vella 3 \n", + "3 2017 1 Ciutat Vella 4 \n", + "4 2017 2 Eixample 5 \n", + "\n", + " Neighborhood.Name Gender Age Number \n", + "0 el Raval Male 0-4 224 \n", + "1 el Barri Gòtic Male 0-4 50 \n", + "2 la Barceloneta Male 0-4 43 \n", + "3 Sant Pere, Santa Caterina i la Ribera Male 0-4 95 \n", + "4 el Fort Pienc Male 0-4 124 " + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "\n", + "from sqlalchemy import create_engine\n", + "import pymysql\n", + "driver = 'mysql+pymysql'\n", + "user = 'root'\n", + "password = 'sushi'\n", + "ip = '127.0.0.1'\n", + "connection_string = f'{driver}://{user}:{password}@{ip}'\n", + "db_connection = create_engine(connection_string)\n", + "df = pd.read_sql_query(\"SELECT * FROM project_week_2.population\", db_connection)\n", + "df.head()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['Ciutat Vella', 'Eixample', 'Sants-Montjuïc', 'Les Corts',\n", + " 'Sarrià-Sant Gervasi', 'Gràcia', 'Horta-Guinardó', 'Nou Barris',\n", + " 'Sant Andreu', 'Sant Martí'], dtype=object)" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df['District.Name'].unique()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Importing Data Sets created with MySQL" + ] + }, + { + "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", + "
SUM(Number)District.NameYear
0101387Ciutat Vella2017
1266416Eixample2017
2181910Sants-Montjuïc2017
382033Les Corts2017
4149279Sarrià-Sant Gervasi2017
5121347Gràcia2017
6168751Horta-Guinardó2017
7166579Nou Barris2017
8147594Sant Andreu2017
9235513Sant Martí2017
\n", + "
" + ], + "text/plain": [ + " SUM(Number) District.Name Year\n", + "0 101387 Ciutat Vella 2017\n", + "1 266416 Eixample 2017\n", + "2 181910 Sants-Montjuïc 2017\n", + "3 82033 Les Corts 2017\n", + "4 149279 Sarrià-Sant Gervasi 2017\n", + "5 121347 Gràcia 2017\n", + "6 168751 Horta-Guinardó 2017\n", + "7 166579 Nou Barris 2017\n", + "8 147594 Sant Andreu 2017\n", + "9 235513 Sant Martí 2017" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pop_dis_2017 = pd.read_csv('population_by_district 2017')\n", + "pop_dis_2017" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Piecing together the new Dataframe" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [], + "source": [ + "pop_dis17 = pop_dis_2017.rename(columns={\"SUM(Number)\": \"Number2017\"})\n" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [], + "source": [ + "pop_dis_2013 = pd.read_csv('population_by_district 2013')" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [], + "source": [ + "pop_dis13 = pop_dis_2013.rename(columns={\"SUM(Number)\": \"Number2013\", \"District.Name\" : \"District.Namerem\"})" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "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", + "
Number2013District.NameremYearNumber2017District.NameYear
0103339Ciutat Vella2013101387Ciutat Vella2017
1264780Eixample2013266416Eixample2017
2182685Sants-Montjuïc2013181910Sants-Montjuïc2017
381640Les Corts201382033Les Corts2017
4145266Sarrià-Sant Gervasi2013149279Sarrià-Sant Gervasi2017
5120949Gràcia2013121347Gràcia2017
6167743Horta-Guinardó2013168751Horta-Guinardó2017
7165748Nou Barris2013166579Nou Barris2017
8146846Sant Andreu2013147594Sant Andreu2017
9232826Sant Martí2013235513Sant Martí2017
\n", + "
" + ], + "text/plain": [ + " Number2013 District.Namerem Year Number2017 District.Name \\\n", + "0 103339 Ciutat Vella 2013 101387 Ciutat Vella \n", + "1 264780 Eixample 2013 266416 Eixample \n", + "2 182685 Sants-Montjuïc 2013 181910 Sants-Montjuïc \n", + "3 81640 Les Corts 2013 82033 Les Corts \n", + "4 145266 Sarrià-Sant Gervasi 2013 149279 Sarrià-Sant Gervasi \n", + "5 120949 Gràcia 2013 121347 Gràcia \n", + "6 167743 Horta-Guinardó 2013 168751 Horta-Guinardó \n", + "7 165748 Nou Barris 2013 166579 Nou Barris \n", + "8 146846 Sant Andreu 2013 147594 Sant Andreu \n", + "9 232826 Sant Martí 2013 235513 Sant Martí \n", + "\n", + " Year \n", + "0 2017 \n", + "1 2017 \n", + "2 2017 \n", + "3 2017 \n", + "4 2017 \n", + "5 2017 \n", + "6 2017 \n", + "7 2017 \n", + "8 2017 \n", + "9 2017 " + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pop_dis = pd.concat([pop_dis13, pop_dis17], axis = 1).reindex(pop_dis13.index)\n", + "pop_dis" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "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", + "
Number2013Number2017District.Name
0103339101387Ciutat Vella
1264780266416Eixample
2182685181910Sants-Montjuïc
38164082033Les Corts
4145266149279Sarrià-Sant Gervasi
5120949121347Gràcia
6167743168751Horta-Guinardó
7165748166579Nou Barris
8146846147594Sant Andreu
9232826235513Sant Martí
\n", + "
" + ], + "text/plain": [ + " Number2013 Number2017 District.Name\n", + "0 103339 101387 Ciutat Vella\n", + "1 264780 266416 Eixample\n", + "2 182685 181910 Sants-Montjuïc\n", + "3 81640 82033 Les Corts\n", + "4 145266 149279 Sarrià-Sant Gervasi\n", + "5 120949 121347 Gràcia\n", + "6 167743 168751 Horta-Guinardó\n", + "7 165748 166579 Nou Barris\n", + "8 146846 147594 Sant Andreu\n", + "9 232826 235513 Sant Martí" + ] + }, + "execution_count": 46, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pop_dis1 = pop_dis.drop([\"Year\", \"District.Namerem\"], axis = 1)\n", + "pop_dis1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Adding the Area as a Variable" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/local/Cellar/jupyterlab/1.2.4/libexec/lib/python3.7/site-packages/ipykernel_launcher.py:2: SettingWithCopyWarning: \n", + "A value is trying to be set on a copy of a slice from a DataFrame.\n", + "Try using .loc[row_indexer,col_indexer] = value instead\n", + "\n", + "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", + " \n" + ] + }, + { + "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", + "
Number2013Number2017District.NameArea_km2Density17
0103339101387Ciutat Vella4.4922580.62
1264780266416Eixample7.4635712.60
2182685181910Sants-Montjuïc21.358520.37
38164082033Les Corts6.0813492.27
4145266149279Sarrià-Sant Gervasi20.097430.51
5120949121347Gràcia4.1928961.10
6167743168751Horta-Guinardó11.9614109.62
7165748166579Nou Barris8.0420718.78
8146846147594Sant Andreu6.5622499.09
9232826235513Sant Martí10.8021806.76
\n", + "
" + ], + "text/plain": [ + " Number2013 Number2017 District.Name Area_km2 Density17\n", + "0 103339 101387 Ciutat Vella 4.49 22580.62\n", + "1 264780 266416 Eixample 7.46 35712.60\n", + "2 182685 181910 Sants-Montjuïc 21.35 8520.37\n", + "3 81640 82033 Les Corts 6.08 13492.27\n", + "4 145266 149279 Sarrià-Sant Gervasi 20.09 7430.51\n", + "5 120949 121347 Gràcia 4.19 28961.10\n", + "6 167743 168751 Horta-Guinardó 11.96 14109.62\n", + "7 165748 166579 Nou Barris 8.04 20718.78\n", + "8 146846 147594 Sant Andreu 6.56 22499.09\n", + "9 232826 235513 Sant Martí 10.80 21806.76" + ] + }, + "execution_count": 55, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "area = [4.49, 7.46, 21.35, 6.08, 20.09, 4.19, 11.96, 8.04, 6.56, 10.80]\n", + "pop_dis1['Area_km2'] = area\n", + "pop_dis1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Performing the caluclations" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Density" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[22580.62,\n", + " 35712.6,\n", + " 8520.37,\n", + " 13492.27,\n", + " 7430.51,\n", + " 28961.1,\n", + " 14109.62,\n", + " 20718.78,\n", + " 22499.09,\n", + " 21806.76]" + ] + }, + "execution_count": 56, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "density17 = pop_dis1.Number2017 / pop_dis1.Area_km2\n", + "density17col = list(round(density17, 2))\n" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/usr/local/Cellar/jupyterlab/1.2.4/libexec/lib/python3.7/site-packages/ipykernel_launcher.py:1: SettingWithCopyWarning: \n", + "A value is trying to be set on a copy of a slice from a DataFrame.\n", + "Try using .loc[row_indexer,col_indexer] = value instead\n", + "\n", + "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", + " \"\"\"Entry point for launching an IPython kernel.\n" + ] + } + ], + "source": [] + }, + { + "cell_type": "code", + "execution_count": 58, + "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", + "
Number2013Number2017District.NameArea_km2Density17
0103339101387Ciutat Vella4.4922580.62
1264780266416Eixample7.4635712.60
2182685181910Sants-Montjuïc21.358520.37
38164082033Les Corts6.0813492.27
4145266149279Sarrià-Sant Gervasi20.097430.51
5120949121347Gràcia4.1928961.10
6167743168751Horta-Guinardó11.9614109.62
7165748166579Nou Barris8.0420718.78
8146846147594Sant Andreu6.5622499.09
9232826235513Sant Martí10.8021806.76
\n", + "
" + ], + "text/plain": [ + " Number2013 Number2017 District.Name Area_km2 Density17\n", + "0 103339 101387 Ciutat Vella 4.49 22580.62\n", + "1 264780 266416 Eixample 7.46 35712.60\n", + "2 182685 181910 Sants-Montjuïc 21.35 8520.37\n", + "3 81640 82033 Les Corts 6.08 13492.27\n", + "4 145266 149279 Sarrià-Sant Gervasi 20.09 7430.51\n", + "5 120949 121347 Gràcia 4.19 28961.10\n", + "6 167743 168751 Horta-Guinardó 11.96 14109.62\n", + "7 165748 166579 Nou Barris 8.04 20718.78\n", + "8 146846 147594 Sant Andreu 6.56 22499.09\n", + "9 232826 235513 Sant Martí 10.80 21806.76" + ] + }, + "execution_count": 58, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pop_dis1" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": {}, + "outputs": [], + "source": [ + "density13 = pop_dis1.Number2013 / pop_dis1.Area_km2\n", + "density13col = list(round(density13, 2))" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "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", + "
Number2013Number2017District.NameArea_km2Density17Density13
0103339101387Ciutat Vella4.4922580.6223015.37
1264780266416Eixample7.4635712.6035493.30
2182685181910Sants-Montjuïc21.358520.378556.67
38164082033Les Corts6.0813492.2713427.63
4145266149279Sarrià-Sant Gervasi20.097430.517230.76
5120949121347Gràcia4.1928961.1028866.11
6167743168751Horta-Guinardó11.9614109.6214025.33
7165748166579Nou Barris8.0420718.7820615.42
8146846147594Sant Andreu6.5622499.0922385.06
9232826235513Sant Martí10.8021806.7621557.96
\n", + "
" + ], + "text/plain": [ + " Number2013 Number2017 District.Name Area_km2 Density17 Density13\n", + "0 103339 101387 Ciutat Vella 4.49 22580.62 23015.37\n", + "1 264780 266416 Eixample 7.46 35712.60 35493.30\n", + "2 182685 181910 Sants-Montjuïc 21.35 8520.37 8556.67\n", + "3 81640 82033 Les Corts 6.08 13492.27 13427.63\n", + "4 145266 149279 Sarrià-Sant Gervasi 20.09 7430.51 7230.76\n", + "5 120949 121347 Gràcia 4.19 28961.10 28866.11\n", + "6 167743 168751 Horta-Guinardó 11.96 14109.62 14025.33\n", + "7 165748 166579 Nou Barris 8.04 20718.78 20615.42\n", + "8 146846 147594 Sant Andreu 6.56 22499.09 22385.06\n", + "9 232826 235513 Sant Martí 10.80 21806.76 21557.96" + ] + }, + "execution_count": 62, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "pop_dis1['Density13'] = density13col\n", + "pop_dis1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Change" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "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", + "
Number2013Number2017District.NameArea_km2Density17Density13Change.Num%
0103339101387Ciutat Vella4.4922580.6223015.37-1.89
1264780266416Eixample7.4635712.6035493.300.62
2182685181910Sants-Montjuïc21.358520.378556.67-0.42
38164082033Les Corts6.0813492.2713427.630.48
4145266149279Sarrià-Sant Gervasi20.097430.517230.762.76
5120949121347Gràcia4.1928961.1028866.110.33
6167743168751Horta-Guinardó11.9614109.6214025.330.60
7165748166579Nou Barris8.0420718.7820615.420.50
8146846147594Sant Andreu6.5622499.0922385.060.51
9232826235513Sant Martí10.8021806.7621557.961.15
\n", + "
" + ], + "text/plain": [ + " Number2013 Number2017 District.Name Area_km2 Density17 \\\n", + "0 103339 101387 Ciutat Vella 4.49 22580.62 \n", + "1 264780 266416 Eixample 7.46 35712.60 \n", + "2 182685 181910 Sants-Montjuïc 21.35 8520.37 \n", + "3 81640 82033 Les Corts 6.08 13492.27 \n", + "4 145266 149279 Sarrià-Sant Gervasi 20.09 7430.51 \n", + "5 120949 121347 Gràcia 4.19 28961.10 \n", + "6 167743 168751 Horta-Guinardó 11.96 14109.62 \n", + "7 165748 166579 Nou Barris 8.04 20718.78 \n", + "8 146846 147594 Sant Andreu 6.56 22499.09 \n", + "9 232826 235513 Sant Martí 10.80 21806.76 \n", + "\n", + " Density13 Change.Num% \n", + "0 23015.37 -1.89 \n", + "1 35493.30 0.62 \n", + "2 8556.67 -0.42 \n", + "3 13427.63 0.48 \n", + "4 7230.76 2.76 \n", + "5 28866.11 0.33 \n", + "6 14025.33 0.60 \n", + "7 20615.42 0.50 \n", + "8 22385.06 0.51 \n", + "9 21557.96 1.15 " + ] + }, + "execution_count": 73, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Change_Num_Col = ((pop_dis1.Number2017 - pop_dis1.Number2013) / pop_dis1.Number2013) * 100\n", + "ch_num = list(round(Change_Num_Col, 2))\n", + "pop_dis1['Change.Num%'] = ch_num\n", + "pop_dis1" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "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", + "
Number2013Number2017District.NameArea_km2Density17Density13Change.Num%Change.Dens%
0103339101387Ciutat Vella4.4922580.6223015.37-1.89-1.89
1264780266416Eixample7.4635712.6035493.300.620.62
2182685181910Sants-Montjuïc21.358520.378556.67-0.42-0.42
38164082033Les Corts6.0813492.2713427.630.480.48
4145266149279Sarrià-Sant Gervasi20.097430.517230.762.762.76
5120949121347Gràcia4.1928961.1028866.110.330.33
6167743168751Horta-Guinardó11.9614109.6214025.330.600.60
7165748166579Nou Barris8.0420718.7820615.420.500.50
8146846147594Sant Andreu6.5622499.0922385.060.510.51
9232826235513Sant Martí10.8021806.7621557.961.151.15
\n", + "
" + ], + "text/plain": [ + " Number2013 Number2017 District.Name Area_km2 Density17 \\\n", + "0 103339 101387 Ciutat Vella 4.49 22580.62 \n", + "1 264780 266416 Eixample 7.46 35712.60 \n", + "2 182685 181910 Sants-Montjuïc 21.35 8520.37 \n", + "3 81640 82033 Les Corts 6.08 13492.27 \n", + "4 145266 149279 Sarrià-Sant Gervasi 20.09 7430.51 \n", + "5 120949 121347 Gràcia 4.19 28961.10 \n", + "6 167743 168751 Horta-Guinardó 11.96 14109.62 \n", + "7 165748 166579 Nou Barris 8.04 20718.78 \n", + "8 146846 147594 Sant Andreu 6.56 22499.09 \n", + "9 232826 235513 Sant Martí 10.80 21806.76 \n", + "\n", + " Density13 Change.Num% Change.Dens% \n", + "0 23015.37 -1.89 -1.89 \n", + "1 35493.30 0.62 0.62 \n", + "2 8556.67 -0.42 -0.42 \n", + "3 13427.63 0.48 0.48 \n", + "4 7230.76 2.76 2.76 \n", + "5 28866.11 0.33 0.33 \n", + "6 14025.33 0.60 0.60 \n", + "7 20615.42 0.50 0.50 \n", + "8 22385.06 0.51 0.51 \n", + "9 21557.96 1.15 1.15 " + ] + }, + "execution_count": 74, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "Change_Dens_Col = ((pop_dis1.Density17 - pop_dis1.Density13) / pop_dis1.Density13) * 100\n", + "ch_dens = list(round(Change_Dens_Col, 2))\n", + "pop_dis1['Change.Dens%'] = ch_dens\n", + "pop_dis1" + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": {}, + "outputs": [], + "source": [ + "final_dataframe = pop_dis1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### Final Dataframe" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "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", + "
Number2013Number2017District.NameArea_km2Density17Density13Change.Num%Change.Dens%
0103339101387Ciutat Vella4.4922580.6223015.37-1.89-1.89
1264780266416Eixample7.4635712.6035493.300.620.62
2182685181910Sants-Montjuïc21.358520.378556.67-0.42-0.42
38164082033Les Corts6.0813492.2713427.630.480.48
4145266149279Sarrià-Sant Gervasi20.097430.517230.762.762.76
5120949121347Gràcia4.1928961.1028866.110.330.33
6167743168751Horta-Guinardó11.9614109.6214025.330.600.60
7165748166579Nou Barris8.0420718.7820615.420.500.50
8146846147594Sant Andreu6.5622499.0922385.060.510.51
9232826235513Sant Martí10.8021806.7621557.961.151.15
\n", + "
" + ], + "text/plain": [ + " Number2013 Number2017 District.Name Area_km2 Density17 \\\n", + "0 103339 101387 Ciutat Vella 4.49 22580.62 \n", + "1 264780 266416 Eixample 7.46 35712.60 \n", + "2 182685 181910 Sants-Montjuïc 21.35 8520.37 \n", + "3 81640 82033 Les Corts 6.08 13492.27 \n", + "4 145266 149279 Sarrià-Sant Gervasi 20.09 7430.51 \n", + "5 120949 121347 Gràcia 4.19 28961.10 \n", + "6 167743 168751 Horta-Guinardó 11.96 14109.62 \n", + "7 165748 166579 Nou Barris 8.04 20718.78 \n", + "8 146846 147594 Sant Andreu 6.56 22499.09 \n", + "9 232826 235513 Sant Martí 10.80 21806.76 \n", + "\n", + " Density13 Change.Num% Change.Dens% \n", + "0 23015.37 -1.89 -1.89 \n", + "1 35493.30 0.62 0.62 \n", + "2 8556.67 -0.42 -0.42 \n", + "3 13427.63 0.48 0.48 \n", + "4 7230.76 2.76 2.76 \n", + "5 28866.11 0.33 0.33 \n", + "6 14025.33 0.60 0.60 \n", + "7 20615.42 0.50 0.50 \n", + "8 22385.06 0.51 0.51 \n", + "9 21557.96 1.15 1.15 " + ] + }, + "execution_count": 76, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "final_dataframe" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "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.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/your-project/Vicky_MySQL/empty.txt b/your-project/Vicky_MySQL/empty.txt new file mode 100644 index 0000000..e69de29 diff --git a/your-project/Vicky_MySQL/general_questions.sql b/your-project/Vicky_MySQL/general_questions.sql new file mode 100644 index 0000000..8697754 --- /dev/null +++ b/your-project/Vicky_MySQL/general_questions.sql @@ -0,0 +1,65 @@ +USE project_week_2; + + +SELECT * FROM population; + +# 1. How many people live in Barcelona in by year? + +SELECT SUM(Number), Year FROM population GROUP BY Year; +# '1620809','2017' +# '1608746','2016' +# '1604555','2015' +# '1602386','2014' +# '1611822','2013' + +# 2. How many and which districts are there? (external: find out size) + +SELECT Count(`District.Name`), `District.Name` FROM population GROUP BY `District.Name`; +# '3840','Ciutat Vella' +# '5760','Eixample' +# '7680','Sants-Montjuïc' +# '2880','Les Corts' +# '5760','Sarrià-Sant Gervasi' +# '4800','Gràcia' +# '10560','Horta-Guinardó' +# '12480','Nou Barris' +# '6720','Sant Andreu' +# '9600','Sant Martí' +# ten districts + +SELECT SUM(Number), `District.Name`, `Year` FROM population WHERE `Year`= "2017" GROUP BY `District.Name`; +SELECT SUM(Number), `District.Name`, `Year` FROM population WHERE `Year`= "2013" GROUP BY `District.Name`; + +# 3. How many neighbourhoods are there? + +SELECT SUM(`Number`), `Neighborhood.Name`, Year FROM population WHERE Year = "2017" GROUP BY `Neighborhood.Name`; +# Note: 960 Count = people in each Neighborhood over time? +# there are 73 neighborhoods + +# 4. How many people live in each district 2017? + +SELECT Count(`District.Name`), `District.Name` FROM population WHERE Year = "2017" GROUP BY `District.Name` ; +# '768','Ciutat Vella' +# '1152','Eixample' +# '1536','Sants-Montjuïc' +# '576','Les Corts' +# '1152','Sarrià-Sant Gervasi' +# '960','Gràcia' +# '2112','Horta-Guinardó' +# '2496','Nou Barris' +# '1344','Sant Andreu' +# '1920','Sant Martí' + +# 5. How many people live in each neighbourhood in 2017? + +SELECT Count(`Neighborhood.Name`), `Neighborhood.Name` FROM population WHERE Year = "2017" GROUP BY `Neighborhood.Name`; +# Note 192 in each Neighborhood in 2017 +# Do again --> sum Numbers + +# 6. Density per district +# See create table area + +# 7. Density per neighbourhood +# N/A + +# 8. Growth per district \ No newline at end of file diff --git a/your-project/Vicky_MySQL/population_by_district 2013 b/your-project/Vicky_MySQL/population_by_district 2013 new file mode 100644 index 0000000..43c08dd --- /dev/null +++ b/your-project/Vicky_MySQL/population_by_district 2013 @@ -0,0 +1,11 @@ +SUM(Number),District.Name,Year +103339,"Ciutat Vella",2013 +264780,Eixample,2013 +182685,Sants-Montjuïc,2013 +81640,"Les Corts",2013 +145266,"Sarrià-Sant Gervasi",2013 +120949,Gràcia,2013 +167743,Horta-Guinardó,2013 +165748,"Nou Barris",2013 +146846,"Sant Andreu",2013 +232826,"Sant Martí",2013 diff --git a/your-project/Vicky_MySQL/population_by_district 2017 b/your-project/Vicky_MySQL/population_by_district 2017 new file mode 100644 index 0000000..cb8390e --- /dev/null +++ b/your-project/Vicky_MySQL/population_by_district 2017 @@ -0,0 +1,11 @@ +SUM(Number),District.Name,Year +101387,"Ciutat Vella",2017 +266416,Eixample,2017 +181910,Sants-Montjuïc,2017 +82033,"Les Corts",2017 +149279,"Sarrià-Sant Gervasi",2017 +121347,Gràcia,2017 +168751,Horta-Guinardó,2017 +166579,"Nou Barris",2017 +147594,"Sant Andreu",2017 +235513,"Sant Martí",2017