Skip to content

Commit

Permalink
Documentation (#25)
Browse files Browse the repository at this point in the history
* wip(documentaion): in this commit the documentation for the scripts and fucntion is added·

* wip(notebooks): in this commit the notebooks added

* Revisando código

* Remove .py files

* Renombrando carpetas

* Moviendo archivo analisis

* Agregar carpeta normzalización y modificar readme de la app

* Agregar README

* Actualizar README

Co-authored-by: Ivan Galaviz <ivan.galaviz@wizeline.com>
  • Loading branch information
hhugoac and ivanovishado authored Jul 4, 2020
1 parent dfd8cd5 commit 8803b97
Show file tree
Hide file tree
Showing 18 changed files with 1,770 additions and 1,024 deletions.
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.vscode
.DS_Store
52 changes: 52 additions & 0 deletions 0. Normalizing datasets/FilterCrimesJalisco18_19.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "FilterCrimesJalisco18-19.ipynb",
"provenance": [],
"collapsed_sections": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "LFnIwgj4YAjs",
"colab_type": "text"
},
"source": [
"# Dataset incidencia criminal\n",
"\n",
"Los datos que utilizamos para nuestro análisis se pueden encontrar [aquí](https://iieg.gob.mx/ns/wp-content/uploads/2020/04/marzo20.rar).\n",
"\n",
"Lamentablemente no existe una ruta directa al .csv."
]
},
{
"cell_type": "code",
"metadata": {
"id": "W7qRThDmPFUC",
"colab_type": "code",
"colab": {}
},
"source": [
"import pandas as pd\n",
"\n",
"df = pd.read_csv('marzo20.csv')\n",
"\n",
"years = [2018, 2019]\n",
"\n",
"filtered = df[(df['Año'].isin(years))]\n",
"\n",
"filtered.to_csv('incidencia_delictiva_jalisco18-19_filter.csv', index=False)"
],
"execution_count": null,
"outputs": []
}
]
}
82 changes: 82 additions & 0 deletions 0. Normalizing datasets/MiBici.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Saturdays.IA MiBici.ipynb",
"provenance": [],
"collapsed_sections": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "JvqasNWf3N6L",
"colab_type": "text"
},
"source": [
"## Downloading datasets"
]
},
{
"cell_type": "code",
"metadata": {
"id": "uw9yCw5mKEKw",
"colab_type": "code",
"colab": {}
},
"source": [
"urls = [\n",
" \"https://www.mibici.net/site/assets/files/1200/datos_abiertos_2018_01.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1201/datos_abiertos_2018_02.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1202/datos_abiertos_2018_03.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1203/datos_abiertos_2018_04.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1204/datos_abiertos_2018_05.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1205/datos_abiertos_2018_06.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1206/datos_abiertos_2018_07.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1207/datos_abiertos_2018_08.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1208/datos_abiertos_2018_09.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1209/datos_abiertos_2018_10.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1210/datos_abiertos_2018_11.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1211/datos_abiertos_2018_12.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1214/datos_abiertos_2019_01.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1217/datos_abiertos_2019_02.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1218/datos_abiertos_2019_03.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1219/datos_abiertos_2019_04.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1220/datos_abiertos_2019_05.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1221/datos_abiertos_2019_06.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1222/datos_abiertos_2019_07.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1223/datos_abiertos_2019_08.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1224/datos_abiertos_2019_09.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1225/datos_abiertos_2019_10.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1227/datos_abiertos_2019_11.csv\",\n",
" \"https://www.mibici.net/site/assets/files/1228/datos_abiertos_2019_12.csv\"\n",
"]\n",
"\n",
"for url in urls:\n",
" !curl -O \"$url\"\n",
"\n",
"import glob\n",
"filenames = glob.glob(\"*.csv\")\n",
"\n",
"import pandas as pd\n",
"combined_csv = pd.concat([pd.read_csv(f, engine=\"python\") for f in filenames])\n",
"combined_csv.to_csv(\"datos.csv\", index=False)\n",
"\n",
"import os\n",
"for f in filenames:\n",
" os.remove(f)\n",
"\n",
"df = pd.read_csv('datos.csv')\n",
"df = df.rename(columns={\"A�o_de_nacimiento\": \"Anio_de_nacimiento\"})"
],
"execution_count": null,
"outputs": []
}
]
}
Loading

0 comments on commit 8803b97

Please sign in to comment.