diff --git a/Posicion15.csv b/Posicion15.csv
new file mode 100644
index 0000000..01a951f
--- /dev/null
+++ b/Posicion15.csv
@@ -0,0 +1,19 @@
+,Equipo,Posicion,Juegos_Jugados,Diferencia_Goles,Puntos
+0,Bayern Munich ,1,34,62.0,79.0
+1,VfL Wolfsburg ,2,34,34.0,69.0
+2,Bor. M'gladbach ,3,34,27.0,66.0
+3,Bay. Leverkusen ,4,34,25.0,61.0
+4,FC Augsburg ,5,34,0.0,49.0
+5,FC Schalke 04 ,6,34,2.0,48.0
+6,Bor. Dortmund ,7,34,5.0,46.0
+7,TSG Hoffenheim ,8,34,-6.0,44.0
+8,E. Frankfurt ,9,34,-6.0,43.0
+9,Werder Bremen ,10,34,-15.0,43.0
+10,1.FSV Mainz 05 ,11,34,-2.0,40.0
+11,1. FC Köln ,12,34,-6.0,40.0
+12,Hannover 96 ,13,34,-16.0,37.0
+13,VfB Stuttgart ,14,34,-18.0,36.0
+14,Hertha BSC ,15,34,-16.0,35.0
+15,Hamburger SV ,16,34,-25.0,35.0
+16,SC Freiburg ,17,34,-11.0,34.0
+17,SC Paderborn ,18,34,-34.0,31.0
diff --git a/Posicion16.csv b/Posicion16.csv
new file mode 100644
index 0000000..9b98d75
--- /dev/null
+++ b/Posicion16.csv
@@ -0,0 +1,19 @@
+,Equipo,Posicion,Juegos_Jugados,Diferencia_Goles,Puntos
+0,Bayern Munich ,1,34,63.0,88.0
+1,Bor. Dortmund ,2,34,48.0,78.0
+2,Bay. Leverkusen ,3,34,16.0,60.0
+3,Bor. M'gladbach ,4,34,17.0,55.0
+4,FC Schalke 04 ,5,34,2.0,52.0
+5,1.FSV Mainz 05 ,6,34,4.0,50.0
+6,Hertha BSC ,7,34,0.0,50.0
+7,VfL Wolfsburg ,8,34,-2.0,45.0
+8,1. FC Köln ,9,34,-4.0,43.0
+9,Hamburger SV ,10,34,-6.0,41.0
+10,FC Ingolstadt ,11,34,-9.0,40.0
+11,FC Augsburg ,12,34,-10.0,38.0
+12,Werder Bremen ,13,34,-15.0,38.0
+13,SV Darmstadt 98 ,14,34,-15.0,38.0
+14,TSG Hoffenheim ,15,34,-15.0,37.0
+15,E. Frankfurt ,16,34,-18.0,36.0
+16,VfB Stuttgart ,17,34,-25.0,33.0
+17,Hannover 96 ,18,34,-31.0,25.0
diff --git a/Posicion17.csv b/Posicion17.csv
new file mode 100644
index 0000000..0f31393
--- /dev/null
+++ b/Posicion17.csv
@@ -0,0 +1,19 @@
+,Equipo,Posicion,Juegos_Jugados,Diferencia_Goles,Puntos
+0,Bayern Munich ,1,34,67.0,82.0
+1,RB Leipzig ,2,34,27.0,67.0
+2,Bor. Dortmund ,3,34,32.0,64.0
+3,TSG Hoffenheim ,4,34,27.0,62.0
+4,1. FC Köln ,5,34,9.0,49.0
+5,Hertha BSC ,6,34,-4.0,49.0
+6,SC Freiburg ,7,34,-18.0,48.0
+7,Werder Bremen ,8,34,-3.0,45.0
+8,Bor. M'gladbach ,9,34,-4.0,45.0
+9,FC Schalke 04 ,10,34,5.0,43.0
+10,E. Frankfurt ,11,34,-7.0,42.0
+11,Bay. Leverkusen ,12,34,-2.0,41.0
+12,FC Augsburg ,13,34,-16.0,38.0
+13,Hamburger SV ,14,34,-28.0,38.0
+14,1.FSV Mainz 05 ,15,34,-11.0,37.0
+15,VfL Wolfsburg ,16,34,-18.0,37.0
+16,FC Ingolstadt ,17,34,-21.0,32.0
+17,SV Darmstadt 98 ,18,34,-35.0,25.0
diff --git a/Posicion18.csv b/Posicion18.csv
new file mode 100644
index 0000000..5e1cdd0
--- /dev/null
+++ b/Posicion18.csv
@@ -0,0 +1,19 @@
+,Equipo,Posicion,Juegos_Jugados,Diferencia_Goles,Puntos
+0,Bayern Munich ,1,34,64.0,84.0
+1,FC Schalke 04 ,2,34,16.0,63.0
+2,TSG Hoffenheim ,3,34,18.0,55.0
+3,Bor. Dortmund ,4,34,17.0,55.0
+4,Bay. Leverkusen ,5,34,14.0,55.0
+5,RB Leipzig ,6,34,4.0,53.0
+6,VfB Stuttgart ,7,34,0.0,51.0
+7,E. Frankfurt ,8,34,0.0,49.0
+8,Bor. M'gladbach ,9,34,-5.0,47.0
+9,Hertha BSC ,10,34,-3.0,43.0
+10,Werder Bremen ,11,34,-3.0,42.0
+11,FC Augsburg ,12,34,-3.0,41.0
+12,Hannover 96 ,13,34,-10.0,39.0
+13,1.FSV Mainz 05 ,14,34,-14.0,36.0
+14,SC Freiburg ,15,34,-24.0,36.0
+15,VfL Wolfsburg ,16,34,-12.0,33.0
+16,Hamburger SV ,17,34,-24.0,31.0
+17,1. FC Köln ,18,34,-35.0,22.0
diff --git a/Posicion19.csv b/Posicion19.csv
new file mode 100644
index 0000000..ca7118d
--- /dev/null
+++ b/Posicion19.csv
@@ -0,0 +1,19 @@
+,Equipo,Posicion,Juegos_Jugados,Diferencia_Goles,Puntos
+0,Bayern Munich ,1,34,56.0,78.0
+1,Bor. Dortmund ,2,34,37.0,76.0
+2,RB Leipzig ,3,34,34.0,66.0
+3,Bay. Leverkusen ,4,34,17.0,58.0
+4,Bor. M'gladbach ,5,34,13.0,55.0
+5,VfL Wolfsburg ,6,34,12.0,55.0
+6,E. Frankfurt ,7,34,12.0,54.0
+7,Werder Bremen ,8,34,9.0,53.0
+8,TSG Hoffenheim ,9,34,18.0,51.0
+9,F. Düsseldorf ,10,34,-16.0,44.0
+10,Hertha BSC ,11,34,-8.0,43.0
+11,1.FSV Mainz 05 ,12,34,-11.0,43.0
+12,SC Freiburg ,13,34,-15.0,36.0
+13,FC Schalke 04 ,14,34,-18.0,33.0
+14,FC Augsburg ,15,34,-20.0,32.0
+15,VfB Stuttgart ,16,34,-38.0,28.0
+16,Hannover 96 ,17,34,-40.0,21.0
+17,1.FC Nuremberg ,18,34,-42.0,19.0
diff --git a/Results.csv b/Results.csv
new file mode 100644
index 0000000..54c2a34
--- /dev/null
+++ b/Results.csv
@@ -0,0 +1,24 @@
+Equipo,Diferencia de Goles,Puntos Totales,Valor Total Promedio,Valor Promedio por Jugador,Bang x Buck [Points/Value]
+1. FC Koeln,-36,154,73.37,2.36,2.098950525
+1.FC Nuremberg,-42,19,42.88,1.48,0.443097015
+1.FSV Mainz 05,-34,206,78.68,2.172,2.618200305
+Bay. Leverkusen,70,275,239.326,7.74,1.149060278
+Bayern Munich ,312,411,642.776,19.042,0.639414042
+Bor. Dortmund,139,319,357.696,10.716,0.891818751
+Bor. M'gladbach,48,268,148.878,4.836,1.800131651
+E. Frankfurt,-19,224,89.876,2.424,2.492322756
+F. Duesseldorf,-16,44,47.43,1.39,0.927682901
+FC Augsburg,-49,198,65.852,1.768,3.006742392
+FC Ingolstadt,-30,72,30.53,421.075,2.358336063
+FC Schalke 04,7,239,222.116,6.384,1.076014335
+Hamburger SV,-83,145,88.5225,2.4275,1.638001638
+Hannover 96,-97,122,74.6775,2.1025,1.63369154
+Hertha BSC,-31,220,87.962,2.652,2.501080012
+RB Leipzig,65,186,194.87,6.176666667,0.954482475
+SC Freiburg,-68,154,66.04,1.9525,2.331920048
+SC Paderborn,-34,31,22.45,802,1.380846325
+SV Darmstadt 98,-50,63,26.315,751,2.394071822
+TSG Hoffenheim,42,249,119.992,3.526,2.075138343
+VfB Stuttgart,-81,148,103.4575,3.1375,1.43053911
+VfL Wolfsburg,14,239,192.648,5.46,1.240604626
+Werder Bremen,-27,221,76.488,2.146,2.889342119
diff --git a/Results.pptx b/Results.pptx
new file mode 100644
index 0000000..2163d7d
Binary files /dev/null and b/Results.pptx differ
diff --git a/Tabla15.csv b/Tabla15.csv
new file mode 100644
index 0000000..926f904
--- /dev/null
+++ b/Tabla15.csv
@@ -0,0 +1,19 @@
+,Equipo,No. Jugadores,Edad Promedio,No. Extranjeros,Valor Total [mil.EUR],Valor Promedio x Jugador [mil.EUR]
+0,Bayern Munich ,33,24.6,17,564.18,17.1
+1,Bor. Dortmund,37,23.7,18,329.8,8.91
+2,FC Schalke 04,36,23.0,15,213.38,5.93
+3,VfL Wolfsburg,30,24.9,18,176.13,5.87
+4,Bay. Leverkusen,26,23.9,14,166.55,6.41
+5,Hamburger SV,38,24.2,21,114.95,3.03
+6,Bor. M'gladbach,27,24.9,14,107.33,3.98
+7,TSG Hoffenheim,30,23.4,13,100.03,3.33
+8,VfB Stuttgart,30,23.7,16,97.9,3.26
+9,Hannover 96,35,24.6,16,78.05,2.23
+10,1.FSV Mainz 05,36,23.9,19,76.9,2.14
+11,Hertha BSC,30,25.3,16,76.48,2.55
+12,E. Frankfurt,30,24.1,14,73.98,2.47
+13,Werder Bremen,36,22.9,17,58.58,1.63
+14,SC Freiburg,30,24.1,13,56.9,1.9
+15,1. FC Köln,27,24.4,14,43.33,1.6
+16,FC Augsburg,35,24.6,18,42.43,1.21
+17,SC Paderborn,28,25.2,8,22.45,802.0
diff --git a/Tabla16.csv b/Tabla16.csv
new file mode 100644
index 0000000..9a61edb
--- /dev/null
+++ b/Tabla16.csv
@@ -0,0 +1,19 @@
+,Equipo,No. Jugadores,Edad Promedio,No. Extranjeros,Valor Total [mil.EUR],Valor Promedio x Jugador [mil.EUR]
+0,Bayern Munich ,34,24.9,19,608.5,17.9
+1,Bor. Dortmund,30,23.9,13,311.6,10.39
+2,VfL Wolfsburg,35,24.5,19,265.43,7.58
+3,FC Schalke 04,32,23.9,14,209.35,6.54
+4,Bay. Leverkusen,33,23.2,20,200.75,6.08
+5,Bor. M'gladbach,29,24.4,17,139.55,4.81
+6,TSG Hoffenheim,31,23.8,16,111.4,3.59
+7,E. Frankfurt,35,23.9,21,87.5,2.5
+8,VfB Stuttgart,34,23.8,18,82.6,2.43
+9,Hamburger SV,35,24.8,18,74.08,2.12
+10,Hannover 96,39,23.5,22,73.58,1.89
+11,Hertha BSC,34,24.3,15,72.9,2.14
+12,1.FSV Mainz 05,39,24.3,22,67.55,1.73
+13,FC Augsburg,39,24.9,20,62.5,1.6
+14,Werder Bremen,39,23.6,18,59.5,1.53
+15,1. FC Köln,25,24.0,12,52.05,2.08
+16,FC Ingolstadt,29,24.2,15,24.38,841.0
+17,SV Darmstadt 98,30,26.3,9,19.8,660.0
diff --git a/Tabla17.csv b/Tabla17.csv
new file mode 100644
index 0000000..68468b3
--- /dev/null
+++ b/Tabla17.csv
@@ -0,0 +1,19 @@
+,Equipo,No. Jugadores,Edad Promedio,No. Extranjeros,Valor Total [mil.EUR],Valor Promedio x Jugador [mil.EUR]
+0,Bayern Munich ,33,25.1,17,595.4,18.04
+1,Bor. Dortmund,31,24.2,16,321.05,10.36
+2,Bay. Leverkusen,39,22.8,21,244.58,6.27
+3,FC Schalke 04,39,23.7,22,238.75,6.12
+4,VfL Wolfsburg,43,23.5,21,225.35,5.24
+5,Bor. M'gladbach,33,23.4,15,155.8,4.72
+6,Hamburger SV,38,23.6,20,94.98,2.5
+7,1.FSV Mainz 05,39,23.3,22,85.7,2.2
+8,1. FC Köln,30,24.4,13,77.4,2.58
+9,TSG Hoffenheim,33,23.5,14,76.55,2.32
+10,Hertha BSC,33,24.0,14,75.98,2.3
+11,Werder Bremen,41,24.5,20,75.08,1.83
+12,RB Leipzig,33,22.6,17,69.18,2.1
+13,FC Augsburg,37,25.3,21,69.0,1.86
+14,E. Frankfurt,35,23.1,22,66.1,1.89
+15,SC Freiburg,36,24.0,13,40.25,1.12
+16,FC Ingolstadt,32,23.8,15,36.68,1.15
+17,SV Darmstadt 98,39,25.7,17,32.83,842.0
diff --git a/Tabla18.csv b/Tabla18.csv
new file mode 100644
index 0000000..71deea0
--- /dev/null
+++ b/Tabla18.csv
@@ -0,0 +1,19 @@
+,Equipo,No. Jugadores,Edad Promedio,No. Extranjeros,Valor Total [mil.EUR],Valor Promedio x Jugador [mil.EUR]
+0,Bayern Munich ,38,23.7,18,610.25,16.06
+1,Bor. Dortmund,35,24.0,19,449.23,12.84
+2,Bay. Leverkusen,27,24.3,14,225.4,8.35
+3,FC Schalke 04,29,24.6,18,205.2,7.08
+4,RB Leipzig,28,23.1,19,200.98,7.18
+5,VfL Wolfsburg,33,23.3,19,150.8,4.57
+6,Bor. M'gladbach,35,23.6,19,150.18,4.29
+7,TSG Hoffenheim,36,23.1,13,123.35,3.43
+8,1. FC Köln,38,23.5,18,120.7,3.18
+9,Hertha BSC,32,23.9,14,89.85,2.81
+10,E. Frankfurt,36,24.0,23,82.3,2.29
+11,Werder Bremen,33,24.6,19,78.43,2.38
+12,1.FSV Mainz 05,33,24.4,18,76.65,2.32
+13,VfB Stuttgart,34,23.8,17,73.88,2.17
+14,SC Freiburg,36,24.5,14,72.73,2.02
+15,Hamburger SV,34,23.5,16,70.08,2.06
+16,FC Augsburg,33,24.6,16,54.38,1.65
+17,Hannover 96,30,24.9,13,48.8,1.63
diff --git a/Tabla19.csv b/Tabla19.csv
new file mode 100644
index 0000000..36cf62e
--- /dev/null
+++ b/Tabla19.csv
@@ -0,0 +1,19 @@
+,Equipo,No. Jugadores,Edad Promedio,No. Extranjeros,Valor Total [mil.EUR],Valor Promedio x Jugador [mil.EUR]
+0,Bayern Munich ,32,24.7,15,835.55,26.11
+1,Bor. Dortmund,34,23.4,19,376.8,11.08
+2,Bay. Leverkusen,31,23.6,16,359.35,11.59
+3,RB Leipzig,34,21.6,21,314.45,9.25
+4,FC Schalke 04,39,24.1,24,243.9,6.25
+5,Bor. M'gladbach,30,24.2,17,191.53,6.38
+6,TSG Hoffenheim,38,23.5,21,188.63,4.96
+7,VfB Stuttgart,34,23.9,17,159.45,4.69
+8,VfL Wolfsburg,36,24.1,21,145.53,4.04
+9,E. Frankfurt,47,23.8,29,139.5,2.97
+10,Hertha BSC,36,23.5,17,124.6,3.46
+11,Werder Bremen,33,24.8,18,110.85,3.36
+12,FC Augsburg,40,23.9,19,100.95,2.52
+13,Hannover 96,37,24.7,18,98.28,2.66
+14,SC Freiburg,34,24.0,9,94.28,2.77
+15,1.FSV Mainz 05,35,23.8,19,86.6,2.47
+16,F. Düsseldorf,34,25.3,16,47.43,1.39
+17,1.FC Nuremberg,29,24.2,11,42.88,1.48
diff --git a/your-code/191102_Web-scraping Transfermarkt_CORRECT.ipynb b/your-code/191102_Web-scraping Transfermarkt_CORRECT.ipynb
new file mode 100644
index 0000000..a70483a
--- /dev/null
+++ b/your-code/191102_Web-scraping Transfermarkt_CORRECT.ipynb
@@ -0,0 +1,498 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Import the needed packages\n",
+ "import pandas as pd\n",
+ "import numpy as np\n",
+ "import requests\n",
+ "from bs4 import BeautifulSoup"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n",
+ " InsecureRequestWarning)\n"
+ ]
+ }
+ ],
+ "source": [
+ "#------------URL SEASON 2018-2019\n",
+ "url = 'https://www.transfermarkt.com/bundesliga/startseite/wettbewerb/L1/plus/?saison_id=2018'\n",
+ "headers = {\"User-Agent\":\"Mozilla/5.0\"}\n",
+ "response = requests.get(url, headers=headers, verify=False)\n",
+ "soup = BeautifulSoup(response.text, 'html.parser')\n",
+ "table = soup.find(\"table\", {\"class\" : \"items\"})\n",
+ "row = table.find_all('tr')\n",
+ "\n",
+ "#-----------------TABLA DE VALOR ECONOMICO--------------------------\n",
+ "equipo = []\n",
+ "jugadores = []\n",
+ "edad = []\n",
+ "extranjeros = []\n",
+ "valor_mercado = []\n",
+ "valor_mercado_promedio = []\n",
+ "for row in table.find_all('tr'):\n",
+ " try:\n",
+ " col = row.find_all('td')\n",
+ " equipo.append(col[2].text)\n",
+ " jugadores.append(col[3].text)\n",
+ " edad.append(col[4].text)\n",
+ " extranjeros.append(col[5].text)\n",
+ " valor_mercado.append(col[6].text)\n",
+ " valor_mercado_promedio.append(col[7].text)\n",
+ " except:\n",
+ " pass\n",
+ " \n",
+ "bl19 = pd.DataFrame({'Equipo': equipo[1:],'No. Jugadores': jugadores[1:], 'Edad Promedio': edad[1:], 'No. Extranjeros': extranjeros[1:],\n",
+ " 'Valor Total [mil.EUR]': valor_mercado[1:], 'Valor Promedio x Jugador [mil.EUR]': valor_mercado_promedio[1:]})\n",
+ "#Limpiar y cambiar nomenclatura\n",
+ "bl19['Edad Promedio'] = bl19['Edad Promedio'].str.replace(',', '.')\n",
+ "bl19['Valor Total [mil.EUR]'] = bl19['Valor Total [mil.EUR]'].str.replace(',', '.').str.replace('mil. €','')\n",
+ "bl19['Valor Promedio x Jugador [mil.EUR]'] = bl19['Valor Promedio x Jugador [mil.EUR]'].str.replace(',', '.').str.replace('mil. €','')\n",
+ "\n",
+ "#Convertir a float algunas columnas\n",
+ "bl19[[\"No. Jugadores\", \"Edad Promedio\", \"No. Extranjeros\"]] = bl19[[\"No. Jugadores\", \"Edad Promedio\", \"No. Extranjeros\"]].apply(pd.to_numeric)\n",
+ "bl19[[\"Valor Total [mil.EUR]\",\"Valor Promedio x Jugador [mil.EUR]\"]] = bl19[[\"Valor Total [mil.EUR]\",\"Valor Promedio x Jugador [mil.EUR]\"]].apply(pd.to_numeric)\n",
+ "\n",
+ "#------------------TABLA DE POSICIONES------------------------------\n",
+ "tabla2 = soup.find_all(\"div\", {\"class\" : \"responsive-table\"})\n",
+ "\n",
+ "equipo2 = []\n",
+ "posicion = []\n",
+ "juegos_jugados = []\n",
+ "diferencia = []\n",
+ "puntos = []\n",
+ "\n",
+ "for row in tabla2[2].find_all('tr'):\n",
+ " try:\n",
+ " col = row.find_all('td')\n",
+ " equipo2.append(col[2].text)\n",
+ " posicion.append(col[0].text)\n",
+ " juegos_jugados.append(col[3].text)\n",
+ " diferencia.append(col[4].text)\n",
+ " puntos.append(col[5].text)\n",
+ " except:\n",
+ " pass\n",
+ "\n",
+ "blpts19 = pd.DataFrame({'Equipo': equipo2[0:],'Posicion': posicion[0:], 'Juegos_Jugados': juegos_jugados[0:], 'Diferencia_Goles': diferencia[0:],\n",
+ " 'Puntos': puntos[0:]})\n",
+ "#Limpiar la tabla\n",
+ "blpts19['Equipo'] = blpts19['Equipo'].str.replace('\\n', '')\n",
+ "\n",
+ "#Convertir a float algunas columnas\n",
+ "blpts19['Posicion'] = blpts19.Posicion.astype(int)\n",
+ "blpts19['Juegos_Jugados'] = blpts19.Juegos_Jugados.astype(int)\n",
+ "blpts19['Diferencia_Goles'] = blpts19.Diferencia_Goles.astype(float)\n",
+ "blpts19['Puntos'] = blpts19.Puntos.astype(float)\n",
+ "\n",
+ "#-----------CONVERT TO CSV--------------------\n",
+ "csv_bl19=bl19.to_csv('Tabla19.csv')\n",
+ "csv_blpts19=blpts19.to_csv('Posicion19.csv')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n",
+ " InsecureRequestWarning)\n"
+ ]
+ }
+ ],
+ "source": [
+ "#------------URL SEASON 2017-2018\n",
+ "url = 'https://www.transfermarkt.com/bundesliga/startseite/wettbewerb/L1/plus/?saison_id=2017'\n",
+ "headers = {\"User-Agent\":\"Mozilla/5.0\"}\n",
+ "response = requests.get(url, headers=headers, verify=False)\n",
+ "soup = BeautifulSoup(response.text, 'html.parser')\n",
+ "table = soup.find(\"table\", {\"class\" : \"items\"})\n",
+ "row = table.find_all('tr')\n",
+ "table = soup.find(\"table\", {\"class\" : \"items\"})\n",
+ "row = table.find_all('tr')\n",
+ "\n",
+ "#-----------------TABLA DE VALOR ECONOMICO--------------------------\n",
+ "equipo = []\n",
+ "jugadores = []\n",
+ "edad = []\n",
+ "extranjeros = []\n",
+ "valor_mercado = []\n",
+ "valor_mercado_promedio = []\n",
+ "for row in table.find_all('tr'):\n",
+ " try:\n",
+ " col = row.find_all('td')\n",
+ " equipo.append(col[2].text)\n",
+ " jugadores.append(col[3].text)\n",
+ " edad.append(col[4].text)\n",
+ " extranjeros.append(col[5].text)\n",
+ " valor_mercado.append(col[6].text)\n",
+ " valor_mercado_promedio.append(col[7].text)\n",
+ " except:\n",
+ " pass\n",
+ " \n",
+ "bl18 = pd.DataFrame({'Equipo': equipo[1:],'No. Jugadores': jugadores[1:], 'Edad Promedio': edad[1:], 'No. Extranjeros': extranjeros[1:],\n",
+ " 'Valor Total [mil.EUR]': valor_mercado[1:], 'Valor Promedio x Jugador [mil.EUR]': valor_mercado_promedio[1:]})\n",
+ "#Limpiar y cambiar nomenclatura\n",
+ "bl18['Edad Promedio'] = bl18['Edad Promedio'].str.replace(',', '.')\n",
+ "bl18['Valor Total [mil.EUR]'] = bl18['Valor Total [mil.EUR]'].str.replace(',', '.').str.replace('mil. €','')\n",
+ "bl18['Valor Promedio x Jugador [mil.EUR]'] = bl18['Valor Promedio x Jugador [mil.EUR]'].str.replace(',', '.').str.replace('mil. €','')\n",
+ "\n",
+ "#Convertir a float algunas columnas\n",
+ "bl18[[\"No. Jugadores\", \"Edad Promedio\", \"No. Extranjeros\"]] = bl18[[\"No. Jugadores\", \"Edad Promedio\", \"No. Extranjeros\"]].apply(pd.to_numeric)\n",
+ "bl18[[\"Valor Total [mil.EUR]\",\"Valor Promedio x Jugador [mil.EUR]\"]] = bl18[[\"Valor Total [mil.EUR]\",\"Valor Promedio x Jugador [mil.EUR]\"]].apply(pd.to_numeric)\n",
+ "\n",
+ "#------------------TABLA DE POSICIONES------------------------------\n",
+ "tabla2 = soup.find_all(\"div\", {\"class\" : \"responsive-table\"})\n",
+ "\n",
+ "equipo2 = []\n",
+ "posicion = []\n",
+ "juegos_jugados = []\n",
+ "diferencia = []\n",
+ "puntos = []\n",
+ "\n",
+ "for row in tabla2[2].find_all('tr'):\n",
+ " try:\n",
+ " col = row.find_all('td')\n",
+ " equipo2.append(col[2].text)\n",
+ " posicion.append(col[0].text)\n",
+ " juegos_jugados.append(col[3].text)\n",
+ " diferencia.append(col[4].text)\n",
+ " puntos.append(col[5].text)\n",
+ " except:\n",
+ " pass\n",
+ "\n",
+ "blpts18 = pd.DataFrame({'Equipo': equipo2[0:],'Posicion': posicion[0:], 'Juegos_Jugados': juegos_jugados[0:], 'Diferencia_Goles': diferencia[0:],\n",
+ " 'Puntos': puntos[0:]})\n",
+ "#Limpiar la tabla\n",
+ "blpts18['Equipo'] = blpts18['Equipo'].str.replace('\\n', '')\n",
+ "\n",
+ "#Convertir a float algunas columnas\n",
+ "blpts18['Posicion'] = blpts18.Posicion.astype(int)\n",
+ "blpts18['Juegos_Jugados'] = blpts18.Juegos_Jugados.astype(int)\n",
+ "blpts18['Diferencia_Goles'] = blpts18.Diferencia_Goles.astype(float)\n",
+ "blpts18['Puntos'] = blpts18.Puntos.astype(float)\n",
+ "\n",
+ "#-----------CONVERT TO CSV--------------------\n",
+ "csv_bl18=bl18.to_csv('Tabla18.csv')\n",
+ "csv_blpts18=blpts18.to_csv('Posicion18.csv')\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n",
+ " InsecureRequestWarning)\n"
+ ]
+ }
+ ],
+ "source": [
+ "#------------URL SEASON 2016-2017\n",
+ "url = 'https://www.transfermarkt.com/bundesliga/startseite/wettbewerb/L1/plus/?saison_id=2016'\n",
+ "headers = {\"User-Agent\":\"Mozilla/5.0\"}\n",
+ "response = requests.get(url, headers=headers, verify=False)\n",
+ "soup = BeautifulSoup(response.text, 'html.parser')\n",
+ "table = soup.find(\"table\", {\"class\" : \"items\"})\n",
+ "row = table.find_all('tr')\n",
+ "table = soup.find(\"table\", {\"class\" : \"items\"})\n",
+ "row = table.find_all('tr')\n",
+ "\n",
+ "#-----------------TABLA DE VALOR ECONOMICO--------------------------\n",
+ "equipo = []\n",
+ "jugadores = []\n",
+ "edad = []\n",
+ "extranjeros = []\n",
+ "valor_mercado = []\n",
+ "valor_mercado_promedio = []\n",
+ "for row in table.find_all('tr'):\n",
+ " try:\n",
+ " col = row.find_all('td')\n",
+ " equipo.append(col[2].text)\n",
+ " jugadores.append(col[3].text)\n",
+ " edad.append(col[4].text)\n",
+ " extranjeros.append(col[5].text)\n",
+ " valor_mercado.append(col[6].text)\n",
+ " valor_mercado_promedio.append(col[7].text)\n",
+ " except:\n",
+ " pass\n",
+ " \n",
+ "bl17 = pd.DataFrame({'Equipo': equipo[1:],'No. Jugadores': jugadores[1:], 'Edad Promedio': edad[1:], 'No. Extranjeros': extranjeros[1:],\n",
+ " 'Valor Total [mil.EUR]': valor_mercado[1:], 'Valor Promedio x Jugador [mil.EUR]': valor_mercado_promedio[1:]})\n",
+ "#Limpiar y cambiar nomenclatura\n",
+ "bl17['Edad Promedio'] = bl17['Edad Promedio'].str.replace(',', '.')\n",
+ "bl17['Valor Total [mil.EUR]'] = bl17['Valor Total [mil.EUR]'].str.replace(',', '.').str.replace('mil. €','')\n",
+ "bl17['Valor Promedio x Jugador [mil.EUR]'] = bl17['Valor Promedio x Jugador [mil.EUR]'].str.replace(',', '.').str.replace('mil. €','').str.replace('K €','')\n",
+ "\n",
+ "#Convertir a float algunas columnas\n",
+ "bl17[[\"No. Jugadores\", \"Edad Promedio\", \"No. Extranjeros\"]] = bl17[[\"No. Jugadores\", \"Edad Promedio\", \"No. Extranjeros\"]].apply(pd.to_numeric)\n",
+ "bl17[[\"Valor Total [mil.EUR]\",\"Valor Promedio x Jugador [mil.EUR]\"]] = bl17[[\"Valor Total [mil.EUR]\",\"Valor Promedio x Jugador [mil.EUR]\"]].apply(pd.to_numeric)\n",
+ "\n",
+ "#------------------TABLA DE POSICIONES------------------------------\n",
+ "tabla2 = soup.find_all(\"div\", {\"class\" : \"responsive-table\"})\n",
+ "\n",
+ "equipo2 = []\n",
+ "posicion = []\n",
+ "juegos_jugados = []\n",
+ "diferencia = []\n",
+ "puntos = []\n",
+ "\n",
+ "for row in tabla2[2].find_all('tr'):\n",
+ " try:\n",
+ " col = row.find_all('td')\n",
+ " equipo2.append(col[2].text)\n",
+ " posicion.append(col[0].text)\n",
+ " juegos_jugados.append(col[3].text)\n",
+ " diferencia.append(col[4].text)\n",
+ " puntos.append(col[5].text)\n",
+ " except:\n",
+ " pass\n",
+ "\n",
+ "blpts17 = pd.DataFrame({'Equipo': equipo2[0:],'Posicion': posicion[0:], 'Juegos_Jugados': juegos_jugados[0:], 'Diferencia_Goles': diferencia[0:],\n",
+ " 'Puntos': puntos[0:]})\n",
+ "#Limpiar la tabla\n",
+ "blpts17['Equipo'] = blpts17['Equipo'].str.replace('\\n', '')\n",
+ "\n",
+ "#Convertir a float algunas columnas\n",
+ "blpts17['Posicion'] = blpts17.Posicion.astype(int)\n",
+ "blpts17['Juegos_Jugados'] = blpts17.Juegos_Jugados.astype(int)\n",
+ "blpts17['Diferencia_Goles'] = blpts17.Diferencia_Goles.astype(float)\n",
+ "blpts17['Puntos'] = blpts17.Puntos.astype(float)\n",
+ "\n",
+ "#-----------CONVERT TO CSV--------------------\n",
+ "csv_bl17=bl17.to_csv('Tabla17.csv')\n",
+ "csv_blpts17=blpts17.to_csv('Posicion17.csv')\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n",
+ " InsecureRequestWarning)\n"
+ ]
+ }
+ ],
+ "source": [
+ "#------------URL SEASON 2015-2016\n",
+ "url = 'https://www.transfermarkt.com/bundesliga/startseite/wettbewerb/L1/plus/?saison_id=2015'\n",
+ "headers = {\"User-Agent\":\"Mozilla/5.0\"}\n",
+ "response = requests.get(url, headers=headers, verify=False)\n",
+ "soup = BeautifulSoup(response.text, 'html.parser')\n",
+ "table = soup.find(\"table\", {\"class\" : \"items\"})\n",
+ "row = table.find_all('tr')\n",
+ "table = soup.find(\"table\", {\"class\" : \"items\"})\n",
+ "row = table.find_all('tr')\n",
+ "\n",
+ "#-----------------TABLA DE VALOR ECONOMICO--------------------------\n",
+ "equipo = []\n",
+ "jugadores = []\n",
+ "edad = []\n",
+ "extranjeros = []\n",
+ "valor_mercado = []\n",
+ "valor_mercado_promedio = []\n",
+ "for row in table.find_all('tr'):\n",
+ " try:\n",
+ " col = row.find_all('td')\n",
+ " equipo.append(col[2].text)\n",
+ " jugadores.append(col[3].text)\n",
+ " edad.append(col[4].text)\n",
+ " extranjeros.append(col[5].text)\n",
+ " valor_mercado.append(col[6].text)\n",
+ " valor_mercado_promedio.append(col[7].text)\n",
+ " except:\n",
+ " pass\n",
+ " \n",
+ "bl16 = pd.DataFrame({'Equipo': equipo[1:],'No. Jugadores': jugadores[1:], 'Edad Promedio': edad[1:], 'No. Extranjeros': extranjeros[1:],\n",
+ " 'Valor Total [mil.EUR]': valor_mercado[1:], 'Valor Promedio x Jugador [mil.EUR]': valor_mercado_promedio[1:]})\n",
+ "#Limpiar y cambiar nomenclatura\n",
+ "bl16['Edad Promedio'] = bl16['Edad Promedio'].str.replace(',', '.')\n",
+ "bl16['Valor Total [mil.EUR]'] = bl16['Valor Total [mil.EUR]'].str.replace(',', '.').str.replace('mil. €','')\n",
+ "bl16['Valor Promedio x Jugador [mil.EUR]'] = bl16['Valor Promedio x Jugador [mil.EUR]'].str.replace(',', '.').str.replace('mil. €','').str.replace('K €','')\n",
+ "\n",
+ "#Convertir a float algunas columnas\n",
+ "bl16[[\"No. Jugadores\", \"Edad Promedio\", \"No. Extranjeros\"]] = bl16[[\"No. Jugadores\", \"Edad Promedio\", \"No. Extranjeros\"]].apply(pd.to_numeric)\n",
+ "bl16[[\"Valor Total [mil.EUR]\",\"Valor Promedio x Jugador [mil.EUR]\"]] = bl16[[\"Valor Total [mil.EUR]\",\"Valor Promedio x Jugador [mil.EUR]\"]].apply(pd.to_numeric)\n",
+ "\n",
+ "#------------------TABLA DE POSICIONES------------------------------\n",
+ "tabla2 = soup.find_all(\"div\", {\"class\" : \"responsive-table\"})\n",
+ "\n",
+ "equipo2 = []\n",
+ "posicion = []\n",
+ "juegos_jugados = []\n",
+ "diferencia = []\n",
+ "puntos = []\n",
+ "\n",
+ "for row in tabla2[2].find_all('tr'):\n",
+ " try:\n",
+ " col = row.find_all('td')\n",
+ " equipo2.append(col[2].text)\n",
+ " posicion.append(col[0].text)\n",
+ " juegos_jugados.append(col[3].text)\n",
+ " diferencia.append(col[4].text)\n",
+ " puntos.append(col[5].text)\n",
+ " except:\n",
+ " pass\n",
+ "\n",
+ "blpts16 = pd.DataFrame({'Equipo': equipo2[0:],'Posicion': posicion[0:], 'Juegos_Jugados': juegos_jugados[0:], 'Diferencia_Goles': diferencia[0:],\n",
+ " 'Puntos': puntos[0:]})\n",
+ "#Limpiar la tabla\n",
+ "blpts16['Equipo'] = blpts16['Equipo'].str.replace('\\n', '')\n",
+ "\n",
+ "#Convertir a float algunas columnas\n",
+ "blpts16['Posicion'] = blpts16.Posicion.astype(int)\n",
+ "blpts16['Juegos_Jugados'] = blpts16.Juegos_Jugados.astype(int)\n",
+ "blpts16['Diferencia_Goles'] = blpts16.Diferencia_Goles.astype(float)\n",
+ "blpts16['Puntos'] = blpts16.Puntos.astype(float)\n",
+ "\n",
+ "#-----------CONVERT TO CSV--------------------\n",
+ "csv_bl16=bl16.to_csv('Tabla16.csv')\n",
+ "csv_blpts16=blpts16.to_csv('Posicion16.csv')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n",
+ " InsecureRequestWarning)\n"
+ ]
+ }
+ ],
+ "source": [
+ "#------------URL SEASON 2014-2015\n",
+ "url = 'https://www.transfermarkt.com/bundesliga/startseite/wettbewerb/L1/plus/?saison_id=2014'\n",
+ "headers = {\"User-Agent\":\"Mozilla/5.0\"}\n",
+ "response = requests.get(url, headers=headers, verify=False)\n",
+ "soup = BeautifulSoup(response.text, 'html.parser')\n",
+ "table = soup.find(\"table\", {\"class\" : \"items\"})\n",
+ "row = table.find_all('tr')\n",
+ "table = soup.find(\"table\", {\"class\" : \"items\"})\n",
+ "row = table.find_all('tr')\n",
+ "\n",
+ "#-----------------TABLA DE VALOR ECONOMICO--------------------------\n",
+ "equipo = []\n",
+ "jugadores = []\n",
+ "edad = []\n",
+ "extranjeros = []\n",
+ "valor_mercado = []\n",
+ "valor_mercado_promedio = []\n",
+ "for row in table.find_all('tr'):\n",
+ " try:\n",
+ " col = row.find_all('td')\n",
+ " equipo.append(col[2].text)\n",
+ " jugadores.append(col[3].text)\n",
+ " edad.append(col[4].text)\n",
+ " extranjeros.append(col[5].text)\n",
+ " valor_mercado.append(col[6].text)\n",
+ " valor_mercado_promedio.append(col[7].text)\n",
+ " except:\n",
+ " pass\n",
+ " \n",
+ "bl15 = pd.DataFrame({'Equipo': equipo[1:],'No. Jugadores': jugadores[1:], 'Edad Promedio': edad[1:], 'No. Extranjeros': extranjeros[1:],\n",
+ " 'Valor Total [mil.EUR]': valor_mercado[1:], 'Valor Promedio x Jugador [mil.EUR]': valor_mercado_promedio[1:]})\n",
+ "#Limpiar y cambiar nomenclatura\n",
+ "bl15['Edad Promedio'] = bl15['Edad Promedio'].str.replace(',', '.')\n",
+ "bl15['Valor Total [mil.EUR]'] = bl15['Valor Total [mil.EUR]'].str.replace(',', '.').str.replace('mil. €','')\n",
+ "bl15['Valor Promedio x Jugador [mil.EUR]'] = bl15['Valor Promedio x Jugador [mil.EUR]'].str.replace(',', '.').str.replace('mil. €','').str.replace('K €','')\n",
+ "\n",
+ "#Convertir a float algunas columnas\n",
+ "bl15[[\"No. Jugadores\", \"Edad Promedio\", \"No. Extranjeros\"]] = bl15[[\"No. Jugadores\", \"Edad Promedio\", \"No. Extranjeros\"]].apply(pd.to_numeric)\n",
+ "bl15[[\"Valor Total [mil.EUR]\",\"Valor Promedio x Jugador [mil.EUR]\"]] = bl15[[\"Valor Total [mil.EUR]\",\"Valor Promedio x Jugador [mil.EUR]\"]].apply(pd.to_numeric)\n",
+ "\n",
+ "#------------------TABLA DE POSICIONES------------------------------\n",
+ "tabla2 = soup.find_all(\"div\", {\"class\" : \"responsive-table\"})\n",
+ "\n",
+ "equipo2 = []\n",
+ "posicion = []\n",
+ "juegos_jugados = []\n",
+ "diferencia = []\n",
+ "puntos = []\n",
+ "\n",
+ "for row in tabla2[2].find_all('tr'):\n",
+ " try:\n",
+ " col = row.find_all('td')\n",
+ " equipo2.append(col[2].text)\n",
+ " posicion.append(col[0].text)\n",
+ " juegos_jugados.append(col[3].text)\n",
+ " diferencia.append(col[4].text)\n",
+ " puntos.append(col[5].text)\n",
+ " except:\n",
+ " pass\n",
+ "\n",
+ "blpts15 = pd.DataFrame({'Equipo': equipo2[0:],'Posicion': posicion[0:], 'Juegos_Jugados': juegos_jugados[0:], 'Diferencia_Goles': diferencia[0:],\n",
+ " 'Puntos': puntos[0:]})\n",
+ "#Limpiar la tabla\n",
+ "blpts15['Equipo'] = blpts15['Equipo'].str.replace('\\n', '')\n",
+ "\n",
+ "#Convertir a float algunas columnas\n",
+ "blpts15['Posicion'] = blpts15.Posicion.astype(int)\n",
+ "blpts15['Juegos_Jugados'] = blpts15.Juegos_Jugados.astype(int)\n",
+ "blpts15['Diferencia_Goles'] = blpts15.Diferencia_Goles.astype(float)\n",
+ "blpts15['Puntos'] = blpts15.Puntos.astype(float)\n",
+ "\n",
+ "#-----------CONVERT TO CSV--------------------\n",
+ "csv_bl15=bl15.to_csv('Tabla15.csv')\n",
+ "csv_blpts15=blpts15.to_csv('Posicion15.csv')"
+ ]
+ },
+ {
+ "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.3"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/your-code/191102_Web-scrapping-Transfermarkt_OLD NOT VALID.ipynb b/your-code/191102_Web-scrapping-Transfermarkt_OLD NOT VALID.ipynb
new file mode 100644
index 0000000..0bbc41a
--- /dev/null
+++ b/your-code/191102_Web-scrapping-Transfermarkt_OLD NOT VALID.ipynb
@@ -0,0 +1,809 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 57,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import pandas as pd\n",
+ "import numpy as np\n",
+ "import requests\n",
+ "from bs4 import BeautifulSoup"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 58,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "C:\\ProgramData\\Anaconda3\\lib\\site-packages\\urllib3\\connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n",
+ " InsecureRequestWarning)\n"
+ ]
+ }
+ ],
+ "source": [
+ "#URL con la tabla del valor de los equipos en LaLiga para la temporada 2019-2020\n",
+ "url = 'https://www.transfermarkt.com/bundesliga/startseite/wettbewerb/L1/plus/?saison_id=2018'\n",
+ "#Para accesar la página\n",
+ "headers = {\"User-Agent\":\"Mozilla/5.0\"}\n",
+ "\n",
+ "#Parsear el contenido \n",
+ "response = requests.get(url, headers=headers, verify=False)\n",
+ "soup = BeautifulSoup(response.text, 'html.parser')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 59,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "
\n",
+ "\n",
+ "\n",
+ "| Club | name | name | Squad | ø age | Players playing abroad | Total market value | ø market value | Total MV | ø MV |
\n",
+ "\n",
+ "\n",
+ "\n",
+ "| | | | 0 | 0 | 0 | - | - | - | - |
\n",
+ "\n",
+ "\n",
+ "\n",
+ " | Bayern Munich  | Bayern Munich | 32 | 24,7 | 15 | 835,55 mil. € | 26,11 mil. € | 835,55 mil. € | 26,11 mil. € |
\n",
+ "\n",
+ " | Borussia Dortmund | Bor. Dortmund | 34 | 23,4 | 19 | 376,80 mil. € | 11,08 mil. € | 376,80 mil. € | 11,08 mil. € |
\n",
+ "\n",
+ " | Bayer 04 Leverkusen | Bay. Leverkusen | 31 | 23,6 | 16 | 359,35 mil. € | 11,59 mil. € | 359,35 mil. € | 11,59 mil. € |
\n",
+ "\n",
+ " | RB Leipzig | RB Leipzig | 34 | 21,6 | 21 | 314,45 mil. € | 9,25 mil. € | 314,45 mil. € | 9,25 mil. € |
\n",
+ "\n",
+ " | FC Schalke 04 | FC Schalke 04 | 39 | 24,1 | 24 | 243,90 mil. € | 6,25 mil. € | 243,90 mil. € | 6,25 mil. € |
\n",
+ "\n",
+ " | Borussia Mönchengladbach | Bor. M'gladbach | 30 | 24,2 | 17 | 191,53 mil. € | 6,38 mil. € | 191,53 mil. € | 6,38 mil. € |
\n",
+ "\n",
+ " | TSG 1899 Hoffenheim | TSG Hoffenheim | 38 | 23,5 | 21 | 188,63 mil. € | 4,96 mil. € | 188,63 mil. € | 4,96 mil. € |
\n",
+ "\n",
+ " | VfB Stuttgart | VfB Stuttgart | 34 | 23,9 | 17 | 159,45 mil. € | 4,69 mil. € | 159,45 mil. € | 4,69 mil. € |
\n",
+ "\n",
+ " | VfL Wolfsburg | VfL Wolfsburg | 36 | 24,1 | 21 | 145,53 mil. € | 4,04 mil. € | 145,53 mil. € | 4,04 mil. € |
\n",
+ "\n",
+ " | Eintracht Frankfurt  | E. Frankfurt | 47 | 23,8 | 29 | 139,50 mil. € | 2,97 mil. € | 139,50 mil. € | 2,97 mil. € |
\n",
+ "\n",
+ " | Hertha BSC | Hertha BSC | 36 | 23,5 | 17 | 124,60 mil. € | 3,46 mil. € | 124,60 mil. € | 3,46 mil. € |
\n",
+ "\n",
+ " | SV Werder Bremen | Werder Bremen | 33 | 24,8 | 18 | 110,85 mil. € | 3,36 mil. € | 110,85 mil. € | 3,36 mil. € |
\n",
+ "\n",
+ " | FC Augsburg | FC Augsburg | 40 | 23,9 | 19 | 100,95 mil. € | 2,52 mil. € | 100,95 mil. € | 2,52 mil. € |
\n",
+ "\n",
+ " | Hannover 96 | Hannover 96 | 37 | 24,7 | 18 | 98,28 mil. € | 2,66 mil. € | 98,28 mil. € | 2,66 mil. € |
\n",
+ "\n",
+ " | SC Freiburg | SC Freiburg | 34 | 24,0 | 9 | 94,28 mil. € | 2,77 mil. € | 94,28 mil. € | 2,77 mil. € |
\n",
+ "\n",
+ " | 1.FSV Mainz 05 | 1.FSV Mainz 05 | 35 | 23,8 | 19 | 86,60 mil. € | 2,47 mil. € | 86,60 mil. € | 2,47 mil. € |
\n",
+ "\n",
+ " | Fortuna Düsseldorf | F. Düsseldorf | 34 | 25,3 | 16 | 47,43 mil. € | 1,39 mil. € | 47,43 mil. € | 1,39 mil. € |
\n",
+ "\n",
+ " | 1.FC Nuremberg | 1.FC Nuremberg | 29 | 24,2 | 11 | 42,88 mil. € | 1,48 mil. € | 42,88 mil. € | 1,48 mil. € |
\n",
+ "\n",
+ "
"
+ ]
+ },
+ "execution_count": 59,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "#Instrucciones para obtener todos los elementos de la tabla\n",
+ "table = soup.find('table', {'class' : 'items'})\n",
+ "table"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 60,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "20"
+ ]
+ },
+ "execution_count": 60,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "#Encuentra todas las filas(tr) de la tabla.\n",
+ "row = table.find_all('tr')\n",
+ "#Para conocer el número de filas en la tabla\n",
+ "len(row)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 61,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "team = []\n",
+ "squad = []\n",
+ "age = []\n",
+ "foreigners = []\n",
+ "total_market_value = []\n",
+ "average_market_value = []\n",
+ "for x in row:\n",
+ " try:\n",
+ " col = x.find_all('td')\n",
+ " team.append(col[2].text)\n",
+ " squad.append(col[3].text)\n",
+ " age.append(col[4].text)\n",
+ " foreigners.append(col[5].text)\n",
+ " total_market_value.append(col[6].text)\n",
+ " average_market_value.append(col[7].text)\n",
+ " except:\n",
+ " pass"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 62,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Team | \n",
+ " No. Players | \n",
+ " Avg. Age | \n",
+ " No. Foreigners | \n",
+ " Total Value | \n",
+ " Average value | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " Bayern Munich | \n",
+ " 32 | \n",
+ " 24.7 | \n",
+ " 15 | \n",
+ " 835.55 mil. € | \n",
+ " 26.11 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Bor. Dortmund | \n",
+ " 34 | \n",
+ " 23.4 | \n",
+ " 19 | \n",
+ " 376.80 mil. € | \n",
+ " 11.08 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " Bay. Leverkusen | \n",
+ " 31 | \n",
+ " 23.6 | \n",
+ " 16 | \n",
+ " 359.35 mil. € | \n",
+ " 11.59 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " RB Leipzig | \n",
+ " 34 | \n",
+ " 21.6 | \n",
+ " 21 | \n",
+ " 314.45 mil. € | \n",
+ " 9.25 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " FC Schalke 04 | \n",
+ " 39 | \n",
+ " 24.1 | \n",
+ " 24 | \n",
+ " 243.90 mil. € | \n",
+ " 6.25 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " Bor. M'gladbach | \n",
+ " 30 | \n",
+ " 24.2 | \n",
+ " 17 | \n",
+ " 191.53 mil. € | \n",
+ " 6.38 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " TSG Hoffenheim | \n",
+ " 38 | \n",
+ " 23.5 | \n",
+ " 21 | \n",
+ " 188.63 mil. € | \n",
+ " 4.96 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " VfB Stuttgart | \n",
+ " 34 | \n",
+ " 23.9 | \n",
+ " 17 | \n",
+ " 159.45 mil. € | \n",
+ " 4.69 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " VfL Wolfsburg | \n",
+ " 36 | \n",
+ " 24.1 | \n",
+ " 21 | \n",
+ " 145.53 mil. € | \n",
+ " 4.04 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " E. Frankfurt | \n",
+ " 47 | \n",
+ " 23.8 | \n",
+ " 29 | \n",
+ " 139.50 mil. € | \n",
+ " 2.97 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 10 | \n",
+ " Hertha BSC | \n",
+ " 36 | \n",
+ " 23.5 | \n",
+ " 17 | \n",
+ " 124.60 mil. € | \n",
+ " 3.46 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 11 | \n",
+ " Werder Bremen | \n",
+ " 33 | \n",
+ " 24.8 | \n",
+ " 18 | \n",
+ " 110.85 mil. € | \n",
+ " 3.36 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 12 | \n",
+ " FC Augsburg | \n",
+ " 40 | \n",
+ " 23.9 | \n",
+ " 19 | \n",
+ " 100.95 mil. € | \n",
+ " 2.52 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 13 | \n",
+ " Hannover 96 | \n",
+ " 37 | \n",
+ " 24.7 | \n",
+ " 18 | \n",
+ " 98.28 mil. € | \n",
+ " 2.66 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 14 | \n",
+ " SC Freiburg | \n",
+ " 34 | \n",
+ " 24.0 | \n",
+ " 9 | \n",
+ " 94.28 mil. € | \n",
+ " 2.77 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 15 | \n",
+ " 1.FSV Mainz 05 | \n",
+ " 35 | \n",
+ " 23.8 | \n",
+ " 19 | \n",
+ " 86.60 mil. € | \n",
+ " 2.47 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 16 | \n",
+ " F. Düsseldorf | \n",
+ " 34 | \n",
+ " 25.3 | \n",
+ " 16 | \n",
+ " 47.43 mil. € | \n",
+ " 1.39 mil. € | \n",
+ "
\n",
+ " \n",
+ " | 17 | \n",
+ " 1.FC Nuremberg | \n",
+ " 29 | \n",
+ " 24.2 | \n",
+ " 11 | \n",
+ " 42.88 mil. € | \n",
+ " 1.48 mil. € | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Team No. Players Avg. Age No. Foreigners Total Value \\\n",
+ "0 Bayern Munich 32 24.7 15 835.55 mil. € \n",
+ "1 Bor. Dortmund 34 23.4 19 376.80 mil. € \n",
+ "2 Bay. Leverkusen 31 23.6 16 359.35 mil. € \n",
+ "3 RB Leipzig 34 21.6 21 314.45 mil. € \n",
+ "4 FC Schalke 04 39 24.1 24 243.90 mil. € \n",
+ "5 Bor. M'gladbach 30 24.2 17 191.53 mil. € \n",
+ "6 TSG Hoffenheim 38 23.5 21 188.63 mil. € \n",
+ "7 VfB Stuttgart 34 23.9 17 159.45 mil. € \n",
+ "8 VfL Wolfsburg 36 24.1 21 145.53 mil. € \n",
+ "9 E. Frankfurt 47 23.8 29 139.50 mil. € \n",
+ "10 Hertha BSC 36 23.5 17 124.60 mil. € \n",
+ "11 Werder Bremen 33 24.8 18 110.85 mil. € \n",
+ "12 FC Augsburg 40 23.9 19 100.95 mil. € \n",
+ "13 Hannover 96 37 24.7 18 98.28 mil. € \n",
+ "14 SC Freiburg 34 24.0 9 94.28 mil. € \n",
+ "15 1.FSV Mainz 05 35 23.8 19 86.60 mil. € \n",
+ "16 F. Düsseldorf 34 25.3 16 47.43 mil. € \n",
+ "17 1.FC Nuremberg 29 24.2 11 42.88 mil. € \n",
+ "\n",
+ " Average value \n",
+ "0 26.11 mil. € \n",
+ "1 11.08 mil. € \n",
+ "2 11.59 mil. € \n",
+ "3 9.25 mil. € \n",
+ "4 6.25 mil. € \n",
+ "5 6.38 mil. € \n",
+ "6 4.96 mil. € \n",
+ "7 4.69 mil. € \n",
+ "8 4.04 mil. € \n",
+ "9 2.97 mil. € \n",
+ "10 3.46 mil. € \n",
+ "11 3.36 mil. € \n",
+ "12 2.52 mil. € \n",
+ "13 2.66 mil. € \n",
+ "14 2.77 mil. € \n",
+ "15 2.47 mil. € \n",
+ "16 1.39 mil. € \n",
+ "17 1.48 mil. € "
+ ]
+ },
+ "execution_count": 62,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "\n",
+ "df_bundesliga = pd.DataFrame({'Team': team[1:],'No. Players': squad[1:], \n",
+ " 'Avg. Age': age[1:], 'No. Foreigners': foreigners[1:],\n",
+ " 'Total Value': total_market_value[1:], \n",
+ " 'Average value': average_market_value[1:]})\n",
+ "#Limpiar y cambiar nomenclatura\n",
+ "df_bundesliga['Avg. Age'] = df_bundesliga['Avg. Age'].str.replace(',', '.')\n",
+ "df_bundesliga['Total Value'] = df_bundesliga['Total Value'].str.replace(',', '.')\n",
+ "df_bundesliga['Average value'] = df_bundesliga['Average value'].str.replace(',', '.')\n",
+ "df_bundesliga"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 63,
+ "metadata": {
+ "scrolled": false
+ },
+ "outputs": [],
+ "source": [
+ "#Limpiar y cambiar nomenclatura\n",
+ "df_bundesliga['Avg. Age'] = df_bundesliga['Avg. Age'].str.replace(',', '.')\n",
+ "df_bundesliga['Total Value'] = df_bundesliga['Total Value'].str.replace(',', '.')\n",
+ "df_bundesliga['Average value'] = df_bundesliga['Average value'].str.replace(',', '.')\n",
+ "df_bundesliga\n",
+ "\n",
+ "#Perteneciente a temporada 2019-2020\n",
+ "df_bl20 = df_bundesliga\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 64,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Team object\n",
+ "No. Players int64\n",
+ "Avg. Age float64\n",
+ "No. Foreigners int64\n",
+ "Total Value object\n",
+ "Average value object\n",
+ "dtype: object"
+ ]
+ },
+ "execution_count": 64,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "#Convertir a float algunas columnas\n",
+ "df_bl20[[\"No. Players\", \"Avg. Age\", \"No. Foreigners\"]] = df_bl20[[\"No. Players\", \"Avg. Age\", \"No. Foreigners\"]].apply(pd.to_numeric)\n",
+ "df_bl20.dtypes"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 65,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Tabla de posiciones\n",
+ "table2 = soup.find_all(\"div\", {\"class\" : \"responsive-table\"})\n",
+ "team2 = []\n",
+ "place = []\n",
+ "matches = []\n",
+ "difference = []\n",
+ "pts = []\n",
+ "for row in table2[2].find_all('tr'):\n",
+ " try:\n",
+ " col = row.find_all('td')\n",
+ " team2.append(col[2].text)\n",
+ " place.append(col[0].text)\n",
+ " matches.append(col[3].text)\n",
+ " difference.append(col[4].text)\n",
+ " pts.append(col[5].text)\n",
+ " except:\n",
+ " pass\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 66,
+ "metadata": {},
+ "outputs": [
+ {
+ "ename": "ValueError",
+ "evalue": "('Unable to parse string \"1\\xa0\" at position 0', 'occurred at index Rank')",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
+ "\u001b[1;32mpandas/_libs/lib.pyx\u001b[0m in \u001b[0;36mpandas._libs.lib.maybe_convert_numeric\u001b[1;34m()\u001b[0m\n",
+ "\u001b[1;31mValueError\u001b[0m: Unable to parse string \"1 \"",
+ "\nDuring handling of the above exception, another exception occurred:\n",
+ "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)",
+ "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m\u001b[0m\n\u001b[0;32m 6\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;31m#Convertir a float algunas columnas\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[0mdf_blpts20\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"Rank\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"Matches\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"Difference\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdf_blpts20\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"Rank\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"Matches\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"Difference\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mapply\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mto_numeric\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 9\u001b[0m \u001b[0mdf_bl20\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdtypes\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\pandas\\core\\frame.py\u001b[0m in \u001b[0;36mapply\u001b[1;34m(self, func, axis, broadcast, raw, reduce, result_type, args, **kwds)\u001b[0m\n\u001b[0;32m 6485\u001b[0m \u001b[0margs\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0margs\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 6486\u001b[0m kwds=kwds)\n\u001b[1;32m-> 6487\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mop\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mget_result\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 6488\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 6489\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mapplymap\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\pandas\\core\\apply.py\u001b[0m in \u001b[0;36mget_result\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 149\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mapply_raw\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 150\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 151\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mapply_standard\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 152\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 153\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mapply_empty_result\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\pandas\\core\\apply.py\u001b[0m in \u001b[0;36mapply_standard\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 255\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 256\u001b[0m \u001b[1;31m# compute the result using the series generator\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 257\u001b[1;33m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mapply_series_generator\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 258\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 259\u001b[0m \u001b[1;31m# wrap results\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\pandas\\core\\apply.py\u001b[0m in \u001b[0;36mapply_series_generator\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 284\u001b[0m \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 285\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mi\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mv\u001b[0m \u001b[1;32min\u001b[0m \u001b[0menumerate\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mseries_gen\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 286\u001b[1;33m \u001b[0mresults\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mi\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mself\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mf\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mv\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 287\u001b[0m \u001b[0mkeys\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mappend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mv\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mname\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 288\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mException\u001b[0m \u001b[1;32mas\u001b[0m \u001b[0me\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mC:\\ProgramData\\Anaconda3\\lib\\site-packages\\pandas\\core\\tools\\numeric.py\u001b[0m in \u001b[0;36mto_numeric\u001b[1;34m(arg, errors, downcast)\u001b[0m\n\u001b[0;32m 133\u001b[0m \u001b[0mcoerce_numeric\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;32mFalse\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0merrors\u001b[0m \u001b[1;32min\u001b[0m \u001b[1;33m(\u001b[0m\u001b[1;34m'ignore'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'raise'\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32melse\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 134\u001b[0m values = lib.maybe_convert_numeric(values, set(),\n\u001b[1;32m--> 135\u001b[1;33m coerce_numeric=coerce_numeric)\n\u001b[0m\u001b[0;32m 136\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 137\u001b[0m \u001b[1;32mexcept\u001b[0m \u001b[0mException\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;32mpandas/_libs/lib.pyx\u001b[0m in \u001b[0;36mpandas._libs.lib.maybe_convert_numeric\u001b[1;34m()\u001b[0m\n",
+ "\u001b[1;31mValueError\u001b[0m: ('Unable to parse string \"1\\xa0\" at position 0', 'occurred at index Rank')"
+ ]
+ }
+ ],
+ "source": [
+ "df_blpts20 = pd.DataFrame({'Team': team2[0:],'Rank': place[0:], \n",
+ " 'Matches': matches[0:], 'Difference': difference[0:],\n",
+ " 'Points': pts[0:]})\n",
+ "#Limpiar la tabla\n",
+ "df_blpts20['Team'] = df_blpts20['Team'].str.replace('\\n', '')\n",
+ "\n",
+ "#Convertir a float algunas columnas\n",
+ "df_blpts20[[\"Rank\", \"Matches\", \"Difference\"]] = df_blpts20[[\"Rank\", \"Matches\", \"Difference\"]].apply(pd.to_numeric)\n",
+ "df_bl20.dtypes"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 171,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Team | \n",
+ " Rank | \n",
+ " Matches | \n",
+ " Difference | \n",
+ " Points | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " Real Madrid | \n",
+ " 2 | \n",
+ " 10 | \n",
+ " 12 | \n",
+ " 21 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " Atlético Madrid | \n",
+ " 3 | \n",
+ " 11 | \n",
+ " 5 | \n",
+ " 20 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " Sevilla FC | \n",
+ " 4 | \n",
+ " 11 | \n",
+ " 2 | \n",
+ " 20 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " Granada CF | \n",
+ " 5 | \n",
+ " 11 | \n",
+ " 5 | \n",
+ " 20 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " Real Sociedad | \n",
+ " 6 | \n",
+ " 11 | \n",
+ " 6 | \n",
+ " 19 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " Valencia | \n",
+ " 7 | \n",
+ " 12 | \n",
+ " -1 | \n",
+ " 17 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " Levante | \n",
+ " 8 | \n",
+ " 12 | \n",
+ " 1 | \n",
+ " 17 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " Villarreal | \n",
+ " 9 | \n",
+ " 11 | \n",
+ " 9 | \n",
+ " 17 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " Athletic | \n",
+ " 10 | \n",
+ " 11 | \n",
+ " 4 | \n",
+ " 16 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " Getafe | \n",
+ " 11 | \n",
+ " 11 | \n",
+ " 2 | \n",
+ " 16 | \n",
+ "
\n",
+ " \n",
+ " | 10 | \n",
+ " CA Osasuna | \n",
+ " 12 | \n",
+ " 11 | \n",
+ " 1 | \n",
+ " 15 | \n",
+ "
\n",
+ " \n",
+ " | 11 | \n",
+ " Real Valladolid | \n",
+ " 13 | \n",
+ " 11 | \n",
+ " -3 | \n",
+ " 14 | \n",
+ "
\n",
+ " \n",
+ " | 12 | \n",
+ " Alavés | \n",
+ " 14 | \n",
+ " 11 | \n",
+ " -5 | \n",
+ " 12 | \n",
+ "
\n",
+ " \n",
+ " | 13 | \n",
+ " SD Eibar | \n",
+ " 15 | \n",
+ " 11 | \n",
+ " -4 | \n",
+ " 12 | \n",
+ "
\n",
+ " \n",
+ " | 14 | \n",
+ " Real Betis | \n",
+ " 16 | \n",
+ " 11 | \n",
+ " -7 | \n",
+ " 12 | \n",
+ "
\n",
+ " \n",
+ " | 15 | \n",
+ " RCD Mallorca | \n",
+ " 17 | \n",
+ " 11 | \n",
+ " -6 | \n",
+ " 11 | \n",
+ "
\n",
+ " \n",
+ " | 16 | \n",
+ " Celta de Vigo | \n",
+ " 18 | \n",
+ " 11 | \n",
+ " -8 | \n",
+ " 9 | \n",
+ "
\n",
+ " \n",
+ " | 17 | \n",
+ " Espanyol | \n",
+ " 19 | \n",
+ " 12 | \n",
+ " -14 | \n",
+ " 8 | \n",
+ "
\n",
+ " \n",
+ " | 18 | \n",
+ " CD Leganés | \n",
+ " 20 | \n",
+ " 11 | \n",
+ " -14 | \n",
+ " 5 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Team Rank Matches Difference Points\n",
+ "0 Real Madrid 2 10 12 21\n",
+ "1 Atlético Madrid 3 11 5 20\n",
+ "2 Sevilla FC 4 11 2 20\n",
+ "3 Granada CF 5 11 5 20\n",
+ "4 Real Sociedad 6 11 6 19\n",
+ "5 Valencia 7 12 -1 17\n",
+ "6 Levante 8 12 1 17\n",
+ "7 Villarreal 9 11 9 17\n",
+ "8 Athletic 10 11 4 16\n",
+ "9 Getafe 11 11 2 16\n",
+ "10 CA Osasuna 12 11 1 15\n",
+ "11 Real Valladolid 13 11 -3 14\n",
+ "12 Alavés 14 11 -5 12\n",
+ "13 SD Eibar 15 11 -4 12\n",
+ "14 Real Betis 16 11 -7 12\n",
+ "15 RCD Mallorca 17 11 -6 11\n",
+ "16 Celta de Vigo 18 11 -8 9\n",
+ "17 Espanyol 19 12 -14 8\n",
+ "18 CD Leganés 20 11 -14 5"
+ ]
+ },
+ "execution_count": 171,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "#Clean Table\n",
+ "dfliga['Team'] = dfliga['Team'].str.replace('\\n', '')\n",
+ "\n",
+ "\n",
+ "dfliga"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 174,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Team object\n",
+ "Rank object\n",
+ "Matches object\n",
+ "Difference object\n",
+ "Points object\n",
+ "dtype: object"
+ ]
+ },
+ "execution_count": 174,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "dfliga = "
+ ]
+ },
+ {
+ "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.3"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}