This repository has been archived by the owner on Feb 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
320 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,320 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 84, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import pandas as pd\n", | ||
"import numpy as np\n", | ||
"import matplotlib.pyplot as plt" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 85, | ||
"metadata": { | ||
"scrolled": true | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<div>\n", | ||
"<style scoped>\n", | ||
" .dataframe tbody tr th:only-of-type {\n", | ||
" vertical-align: middle;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe tbody tr th {\n", | ||
" vertical-align: top;\n", | ||
" }\n", | ||
"\n", | ||
" .dataframe thead th {\n", | ||
" text-align: right;\n", | ||
" }\n", | ||
"</style>\n", | ||
"<table border=\"1\" class=\"dataframe\">\n", | ||
" <thead>\n", | ||
" <tr style=\"text-align: right;\">\n", | ||
" <th></th>\n", | ||
" <th>NOMBRE</th>\n", | ||
" <th>SEXO</th>\n", | ||
" <th>EDAD</th>\n", | ||
" <th>CIUDAD</th>\n", | ||
" <th>COMUNIDAD</th>\n", | ||
" <th>PUESTO</th>\n", | ||
" <th>GALA1</th>\n", | ||
" <th>GALA2</th>\n", | ||
" <th>GALA3</th>\n", | ||
" <th>GALA4</th>\n", | ||
" <th>GALA5</th>\n", | ||
" <th>GALA6</th>\n", | ||
" <th>GALA7</th>\n", | ||
" <th>GALA8</th>\n", | ||
" <th>GALA9</th>\n", | ||
" <th>GALA10</th>\n", | ||
" <th>GALA11</th>\n", | ||
" <th>GALA12</th>\n", | ||
" <th>GALA13</th>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>EDICION</th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" <th></th>\n", | ||
" </tr>\n", | ||
" </thead>\n", | ||
" <tbody>\n", | ||
" <tr>\n", | ||
" <th>2001</th>\n", | ||
" <td>Rosa López</td>\n", | ||
" <td>F</td>\n", | ||
" <td>20</td>\n", | ||
" <td>Granada</td>\n", | ||
" <td>Andalucía</td>\n", | ||
" <td>1</td>\n", | ||
" <td>FAV</td>\n", | ||
" <td>FAV</td>\n", | ||
" <td>FAV</td>\n", | ||
" <td>FAV</td>\n", | ||
" <td>FAV</td>\n", | ||
" <td>FAV</td>\n", | ||
" <td>CFAV</td>\n", | ||
" <td>FAV</td>\n", | ||
" <td>SPROF</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>2001</th>\n", | ||
" <td>David Bisbal</td>\n", | ||
" <td>M</td>\n", | ||
" <td>22</td>\n", | ||
" <td>Almería</td>\n", | ||
" <td>Andalucía</td>\n", | ||
" <td>2</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>CFAV</td>\n", | ||
" <td>CFAV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>CFAV</td>\n", | ||
" <td>FAV</td>\n", | ||
" <td>CFAV</td>\n", | ||
" <td>FAV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>2001</th>\n", | ||
" <td>David Bustamante</td>\n", | ||
" <td>M</td>\n", | ||
" <td>19</td>\n", | ||
" <td>San Vicente de la Barquera</td>\n", | ||
" <td>Asturias</td>\n", | ||
" <td>3</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>CFAV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>CFAV</td>\n", | ||
" <td>CFAV</td>\n", | ||
" <td>SCOMP</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SCOMP</td>\n", | ||
" <td>NOM</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>2001</th>\n", | ||
" <td>Chenoa</td>\n", | ||
" <td>F</td>\n", | ||
" <td>26</td>\n", | ||
" <td>Palma</td>\n", | ||
" <td>Baleares</td>\n", | ||
" <td>4</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>CFAV</td>\n", | ||
" <td>CFAV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>CFAV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>2001</th>\n", | ||
" <td>Manu Tenorio</td>\n", | ||
" <td>M</td>\n", | ||
" <td>26</td>\n", | ||
" <td>Sevilla</td>\n", | ||
" <td>Andalucía</td>\n", | ||
" <td>5</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SPROF</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>CFAV</td>\n", | ||
" <td>SPROF</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" <td>SALV</td>\n", | ||
" </tr>\n", | ||
" </tbody>\n", | ||
"</table>\n", | ||
"</div>" | ||
], | ||
"text/plain": [ | ||
" NOMBRE SEXO EDAD CIUDAD COMUNIDAD \\\n", | ||
"EDICION \n", | ||
"2001 Rosa López F 20 Granada Andalucía \n", | ||
"2001 David Bisbal M 22 Almería Andalucía \n", | ||
"2001 David Bustamante M 19 San Vicente de la Barquera Asturias \n", | ||
"2001 Chenoa F 26 Palma Baleares \n", | ||
"2001 Manu Tenorio M 26 Sevilla Andalucía \n", | ||
"\n", | ||
" PUESTO GALA1 GALA2 GALA3 GALA4 GALA5 GALA6 GALA7 GALA8 GALA9 \\\n", | ||
"EDICION \n", | ||
"2001 1 FAV FAV FAV FAV FAV FAV CFAV FAV SPROF \n", | ||
"2001 2 SALV SALV CFAV CFAV SALV CFAV FAV CFAV FAV \n", | ||
"2001 3 SALV SALV CFAV SALV CFAV CFAV SCOMP SALV SCOMP \n", | ||
"2001 4 SALV SALV SALV CFAV CFAV SALV CFAV SALV SALV \n", | ||
"2001 5 SALV SALV SALV SALV SPROF SALV SALV SALV CFAV \n", | ||
"\n", | ||
" GALA10 GALA11 GALA12 GALA13 \n", | ||
"EDICION \n", | ||
"2001 SALV SALV SALV SALV \n", | ||
"2001 SALV SALV SALV SALV \n", | ||
"2001 NOM SALV SALV SALV \n", | ||
"2001 SALV SALV SALV SALV \n", | ||
"2001 SPROF SALV SALV SALV " | ||
] | ||
}, | ||
"execution_count": 85, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"df = pd.read_excel('data.xlsx', index_col='EDICION')\n", | ||
"df.head()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 91, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"9" | ||
] | ||
}, | ||
"execution_count": 91, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"df.index.unique().size" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 86, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"GALAS = [f'GALA{i}' for i in range(1, 14)]" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 92, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"GALA1 80\n", | ||
"GALA2 73\n", | ||
"GALA3 63\n", | ||
"GALA4 53\n", | ||
"GALA5 45\n", | ||
"GALA6 37\n", | ||
"GALA7 26\n", | ||
"GALA8 27\n", | ||
"GALA9 21\n", | ||
"GALA10 31\n", | ||
"GALA11 50\n", | ||
"GALA12 45\n", | ||
"GALA13 45\n", | ||
"dtype: int64" | ||
] | ||
}, | ||
"execution_count": 92, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"(df[GALAS] == 'SALV').sum()" | ||
] | ||
} | ||
], | ||
"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.6.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |