Skip to content

Commit

Permalink
Merge pull request #2 from Geometrein/master
Browse files Browse the repository at this point in the history
initial commit
  • Loading branch information
Geometrein committed Jul 16, 2023
2 parents 85df849 + 18b7ea8 commit 6544228
Show file tree
Hide file tree
Showing 28 changed files with 44 additions and 51 deletions.
63 changes: 27 additions & 36 deletions 01_population_pyramid.ipynb

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions 03_crime_rates.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
"def plot_crime_rates_by_year(crimes_df: pd.DataFrame, permits_df: pd.DataFrame) -> tuple:\n",
" # Data\n",
" grouped_crimes = crimes_df.groupby(['Year'])['Persons suspected of solved offences'].sum().reset_index()\n",
"\n",
" permits_df = permits_df.loc[(permits_df['Decision'] == 'Positive') & (permits_df['Year'] < 2023)]\n",
" grouped_permits = permits_df.groupby(['Year'])['Number'].sum().reset_index()\n",
" grouped_permits.sort_values(by='Number', inplace=True, ascending=False)\n",
Expand All @@ -104,16 +103,12 @@
" # Labels\n",
" plt.suptitle(f\"Total Number of Crimes Committed in Finland Between 2000-2022 \", y=0.93, fontsize=15)\n",
" ax1.set(xlabel='Year', ylabel=f'Persons suspected of solved offences')\n",
"\n",
" ax1.set_xticks(range(2000, 2023, 1))\n",
" ax1.set_xlim([2015, 2023])\n",
"\n",
" ax1.tick_params(axis='y', colors='#4489BD')\n",
" ax2.tick_params(axis='y', colors='#2c8c1f')\n",
"\n",
" ax1.grid(axis='y')\n",
" ax2.grid(False)\n",
"\n",
" ax1.yaxis.set_major_formatter(ticker.EngFormatter())\n",
" ax2.yaxis.set_major_formatter(ticker.EngFormatter())\n",
" # Author\n",
Expand Down Expand Up @@ -179,7 +174,6 @@
" # Highest correlation\n",
" ax.axhline(y=np.max(ccf), color='#4489BD', lw=.8, linestyle='--', label='highest correlation')\n",
" ax.axhline(y=np.min(ccf), color='#4489BD', lw=.8, linestyle='--')\n",
"\n",
" ax.set(ylim = [-1, 1])\n",
" ax.set_title('Cross Correlation Between Crime Rates and Issued Residence Permits', fontsize=15)\n",
" ax.set_ylabel('Correlation Coefficients', weight='bold', fontsize=12)\n",
Expand Down
2 changes: 1 addition & 1 deletion 04_employment.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"entrepreneur_df = employment_df.loc[employment_df['Main type of activity']=='Total'].copy(deep=True)\n",
"entrepreneur_df['type'] = entrepreneur_df['Occupational status'] + '/' + entrepreneur_df['Nationality']\n",
"entrepreneur_df = entrepreneur_df.drop(columns=['Main type of activity', 'Sex', 'Nationality', 'Occupational status'])\n",
"df_melt= pd.melt(entrepreneur_df, id_vars='type', var_name='year', value_name='number')\n",
"df_melt = pd.melt(entrepreneur_df, id_vars='type', var_name='year', value_name='number')\n",
"df_melt[['type', 'Nationality']] = df_melt['type'].str.split(\"/\", expand = True)\n",
"df_melt = df_melt[['Nationality', 'type', 'year', 'number']]\n",
"df_melt = df_melt.loc[df_melt['type'] != 'Not employed']\n",
Expand Down
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,30 @@

---

![](charts/population_pyramid.gif)
![population Pyramid animation](charts/population_pyramid.gif)

## About
This repo contains a collection of jupyter notebooks and data extracts used to generate the following articles:

[![Medium Badge](https://img.shields.io/badge/Medium-303030?style=for-the-badge&logo=medium&logoColor=white)]()
[![Linkedin](https://img.shields.io/badge/Linkedin-0077B5?style=for-the-badge&logo=Linkedin&logoColor=white)]()

## Data Sources

---
The data used in this project is extracted from the following sources:

[![Statfin](https://img.shields.io/badge/Statfin_Database-0077B5?style=for-the-badge&logo=redis&logoColor=white)](https://pxdata.stat.fi/PxWeb/pxweb/en/StatFin/)


## Installation

---
Launch the notebooks in binder:

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Geometrein/the-finnish-line/HEAD)

#### Local install
Move to the finnish line directory :)
```
cd the_finnish_line
Expand All @@ -26,11 +41,4 @@ source venv/bin/activate
pip install -r requirements.txt
```

## Data Sources

---
The data used in this project is extracted from the following sources:

[![Statfin](https://img.shields.io/badge/Statfin_Database-0077B5?style=for-the-badge&logo=redis&logoColor=white)](https://pxdata.stat.fi/PxWeb/pxweb/en/StatFin/)


Binary file modified charts/age_dependency_vs_cabinets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2009.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2011.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2012.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2013.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2014.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2015.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2016.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2017.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2018.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2019.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2020.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2021.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified charts/population_pyramid_2022.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6544228

Please sign in to comment.