\n"]},"metadata":{},"execution_count":40}]},{"cell_type":"code","source":["lista_nueva = []\n","for string in lista:\n"," x = float(string.replace(\"k\", \"\"))\n"," lista_nueva.append(x)\n","import statistics\n","statistics.mean(lista_nueva)*1000"],"metadata":{"id":"kgb8Xd9k6rc5","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"b4adecf3113840da87120e0a2f526100","outputId":"1b8a95ba-61d2-42aa-b408-646524088cdd","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":405,"user_tz":180,"timestamp":1647172590472},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"21842.85714285714"},"metadata":{},"execution_count":6}],"execution_count":null},{"cell_type":"markdown","source":["# Recodificacion de valores para cada columna"],"metadata":{"id":"v4tcaU2WI4jA","cell_id":"05738525c40841e1857fd19a18ad30df","deepnote_cell_type":"markdown"}},{"cell_type":"code","source":["# Parte 2 (Una forma de hacerlo) uso de filtros\n","df_paises=df[df['country'].isin(['Argentina','Chile','Colombia','Bolivia','Peru','Brasil','Uruguay','Venezuela','Paraguay','Ecuador'])].iloc[:,217:224]\n","lista=df_paises.values\n","lista"],"metadata":{"id":"6x2mMM5667Wh","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"798a82749024442e99149a1c69a3b291","outputId":"e40cd2fe-c0eb-4e80-ab15-452745fddd98","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":390,"user_tz":180,"timestamp":1647172689069},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"array([['23.2k', '23.6k', '22.8k', '22.1k', '19.7k', '20.6k', '20.9k'],\n ['8200', '8420', '8660', '8720', '7940', '8250', '8470'],\n ['24.6k', '24.5k', '25.2k', '25.1k', '23.2k', '24.3k', '25k'],\n ['14.2k', '14.2k', '14.4k', '14.6k', '13.5k', '14k', '14.4k'],\n ['11.6k', '11.6k', '11.6k', '11.4k', '10.4k', '10.5k', '10.5k'],\n ['12.4k', '12.5k', '12.8k', '12.8k', '11.3k', '12.1k', '12.6k'],\n ['12.2k', '12.6k', '12.8k', '12.7k', '12.4k', '12.7k', '13k'],\n ['20.9k', '21.3k', '21.6k', '21.6k', '20.3k', '20.8k', '21.4k'],\n ['17.5k', '14.8k', '12.3k', '8320', '5800', '5290', '5150']],\n dtype=object)"},"metadata":{},"execution_count":7}],"execution_count":null},{"cell_type":"code","source":["lista_nueva = []\n","for string in lista:\n"," for j in string:\n"," if 'k' in j:\n"," #print(j)\n"," x = float(j.replace(\"k\", \"\"))*1000\n"," lista_nueva.append(x)\n"," #print(x)\n"," else:\n"," x= float(j)\n"," lista_nueva.append(x)\n"," #print('---')\n"," #print(x)\n","import statistics\n","statistics.mean(lista_nueva)"],"metadata":{"id":"-i1ORA6F-C1F","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"a06d1f89d379454cac8d10e5288dbe48","outputId":"86b032e9-cc81-4c1a-cf88-0ebac9438569","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":6,"user_tz":180,"timestamp":1647172690712},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"15116.190476190477"},"metadata":{},"execution_count":8}],"execution_count":null},{"cell_type":"code","source":["df.country.unique()"],"metadata":{"id":"Fg9LQ5TF_EwU","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"cebd77b11c0049678572ce4c8849b520","outputId":"a8e56efa-db56-47f6-b4d4-ce9b9c3f87ee","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":6,"user_tz":180,"timestamp":1647172691699},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"array(['Afghanistan', 'Angola', 'Albania', 'Andorra',\n 'United Arab Emirates', 'Argentina', 'Armenia',\n 'Antigua and Barbuda', 'Australia', 'Austria', 'Azerbaijan',\n 'Burundi', 'Belgium', 'Benin', 'Burkina Faso', 'Bangladesh',\n 'Bulgaria', 'Bahrain', 'Bahamas', 'Bosnia and Herzegovina',\n 'Belarus', 'Belize', 'Bolivia', 'Brazil', 'Barbados', 'Brunei',\n 'Bhutan', 'Botswana', 'Central African Republic', 'Canada',\n 'Switzerland', 'Chile', 'China', \"Cote d'Ivoire\", 'Cameroon',\n 'Congo, Dem. Rep.', 'Congo, Rep.', 'Colombia', 'Comoros',\n 'Cape Verde', 'Costa Rica', 'Cuba', 'Cyprus', 'Czech Republic',\n 'Germany', 'Djibouti', 'Dominica', 'Denmark', 'Dominican Republic',\n 'Algeria', 'Ecuador', 'Egypt', 'Eritrea', 'Spain', 'Estonia',\n 'Ethiopia', 'Finland', 'Fiji', 'France', 'Micronesia, Fed. Sts.',\n 'Gabon', 'United Kingdom', 'Georgia', 'Ghana', 'Guinea', 'Gambia',\n 'Guinea-Bissau', 'Equatorial Guinea', 'Greece', 'Grenada',\n 'Guatemala', 'Guyana', 'Hong Kong, China', 'Honduras', 'Croatia',\n 'Haiti', 'Hungary', 'Indonesia', 'India', 'Ireland', 'Iran',\n 'Iraq', 'Iceland', 'Israel', 'Italy', 'Jamaica', 'Jordan', 'Japan',\n 'Kazakhstan', 'Kenya', 'Kyrgyz Republic', 'Cambodia', 'Kiribati',\n 'St. Kitts and Nevis', 'South Korea', 'Kuwait', 'Lao', 'Lebanon',\n 'Liberia', 'Libya', 'St. Lucia', 'Sri Lanka', 'Lesotho',\n 'Lithuania', 'Luxembourg', 'Latvia', 'Morocco', 'Monaco',\n 'Moldova', 'Madagascar', 'Maldives', 'Mexico', 'Marshall Islands',\n 'North Macedonia', 'Mali', 'Malta', 'Myanmar', 'Montenegro',\n 'Mongolia', 'Mozambique', 'Mauritania', 'Mauritius', 'Malawi',\n 'Malaysia', 'Namibia', 'Niger', 'Nigeria', 'Nicaragua',\n 'Netherlands', 'Norway', 'Nepal', 'Nauru', 'New Zealand', 'Oman',\n 'Pakistan', 'Panama', 'Peru', 'Philippines', 'Palau',\n 'Papua New Guinea', 'Poland', 'North Korea', 'Portugal',\n 'Paraguay', 'Palestine', 'Qatar', 'Romania', 'Russia', 'Rwanda',\n 'Saudi Arabia', 'Sudan', 'Senegal', 'Singapore', 'Solomon Islands',\n 'Sierra Leone', 'El Salvador', 'San Marino', 'Somalia', 'Serbia',\n 'South Sudan', 'Sao Tome and Principe', 'Suriname',\n 'Slovak Republic', 'Slovenia', 'Sweden', 'Eswatini', 'Seychelles',\n 'Syria', 'Chad', 'Togo', 'Thailand', 'Tajikistan', 'Turkmenistan',\n 'Timor-Leste', 'Tonga', 'Trinidad and Tobago', 'Tunisia', 'Turkey',\n 'Tuvalu', 'Taiwan', 'Tanzania', 'Uganda', 'Ukraine', 'Uruguay',\n 'United States', 'Uzbekistan', 'St. Vincent and the Grenadines',\n 'Venezuela', 'Vietnam', 'Vanuatu', 'Samoa', 'Yemen',\n 'South Africa', 'Zambia', 'Zimbabwe'], dtype=object)"},"metadata":{},"execution_count":9}],"execution_count":null},{"cell_type":"code","source":["df_paises=df[df['country'].isin(['United States','Canada','Mexico','Costa Rica','Nicaragua'])].iloc[:,217:224]\n","lista=df_paises.values\n","lista"],"metadata":{"id":"zbjXjxDw_Aky","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"4f92fae8e9d84c2fb6e91453b75266b4","outputId":"424ab1c1-2e93-4291-eb68-e9f65abdc235","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":6,"user_tz":180,"timestamp":1647172693762},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"array([['47.6k', '48.5k', '48.8k', '48.9k', '45.7k', '47.6k', '49.3k'],\n ['19.2k', '19.7k', '20.1k', '20.3k', '19.1k', '19.4k', '19.9k'],\n ['19.6k', '19.8k', '20k', '19.8k', '18k', '18.7k', '19.1k'],\n ['5810', '6000', '5700', '5410', '5270', '5240', '5330'],\n ['59k', '60.1k', '61.5k', '62.5k', '60k', '63.5k', '65.4k']],\n dtype=object)"},"metadata":{},"execution_count":10}],"execution_count":null},{"cell_type":"code","source":["lista_nueva = []\n","for string in lista:\n"," for j in string:\n"," if 'k' in j:\n"," #print(j)\n"," x = float(j.replace(\"k\", \"\"))*1000\n"," lista_nueva.append(x)\n"," #print(x)\n"," else:\n"," x= float(j)\n"," lista_nueva.append(x)\n"," #print('---')\n"," #print(x)\n","import statistics\n","statistics.mean(lista_nueva)"],"metadata":{"id":"tc9vLCMJ_ivC","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"d784eca39fe746b9b813627e0966ebb4","outputId":"deed5d12-6469-49a4-819b-61b9f627e2c1","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":408,"user_tz":180,"timestamp":1647172696362},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"30853.14285714286"},"metadata":{},"execution_count":11}],"execution_count":null},{"cell_type":"markdown","source":["# Desafío generico final\n"],"metadata":{"id":"IQ8qTJ2SHgrr","cell_id":"e1e593168aec4f898ddba45c9ab91ffe","deepnote_cell_type":"markdown"}},{"cell_type":"code","source":["from google.colab import drive\n","import os\n","drive.mount('/content/gdrive')\n","# Establecer ruta de acceso en drive\n","import os\n","print(os.getcwd())\n","os.chdir(\"/content/gdrive/My Drive\")"],"metadata":{"id":"s4zCkFHSHjqh","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"0ac53d43b11447ca97a404ade9ca3ed0","outputId":"6b8e9235-f325-4457-b506-2bd4a26df601","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":70311,"user_tz":300,"timestamp":1646685871447},"deepnote_cell_type":"code"},"outputs":[{"output_type":"stream","name":"stdout","text":"Mounted at /content/gdrive\n/content\n"}],"execution_count":null},{"cell_type":"code","source":["import pandas as pd\n","import sqlite3\n","\n","sql= \"SELECT name FROM sqlite_master WHERE type='table'\"\n","# Leer el archivo sqllite y convertirlo a dataframe\n","con =sqlite3.connect(\"nba_salary.sqlite\")\n","df=pd.read_sql_query(sql,con)\n","# Verificar el resultado en un dataframe\n","print(df)\n","con.close()"],"metadata":{"id":"-iMb3or5rJDW","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"4fa45b2a3b1d4603806aca67c2e379a2","outputId":"66fe4b8a-aeb0-492f-dba8-c8076a14d219","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":3170,"user_tz":300,"timestamp":1646685874603},"deepnote_cell_type":"code"},"outputs":[{"output_type":"stream","name":"stdout","text":" name\n0 NBA_season1718_salary\n1 Seasons_Stats\n"}],"execution_count":null},{"cell_type":"markdown","source":["# Punto 1"],"metadata":{"id":"0WHCEscHrPht","cell_id":"baf51c654d1e47099981141c6ece53ec","deepnote_cell_type":"markdown"}},{"cell_type":"code","source":["con =sqlite3.connect(\"nba_salary.sqlite\")\n","df=pd.read_sql_query('SELECT * FROM NBA_season1718_salary',con)\n","df.head()"],"metadata":{"id":"Gm__YYG2rQqS","colab":{"height":206,"base_uri":"https://localhost:8080/"},"cell_id":"f03ee3d1c09545459d246c4a7476ada9","outputId":"36c22830-7fc4-4edb-dabc-3a8037876840","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":419,"user_tz":300,"timestamp":1646686052438},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/html":"\n
\n
\n
\n\n
\n \n
\n
\n
X1
\n
Player
\n
Tm
\n
season17_18
\n
\n \n \n
\n
0
\n
1.0
\n
Stephen Curry
\n
GSW
\n
34682550.0
\n
\n
\n
1
\n
2.0
\n
LeBron James
\n
CLE
\n
33285709.0
\n
\n
\n
2
\n
3.0
\n
Paul Millsap
\n
DEN
\n
31269231.0
\n
\n
\n
3
\n
4.0
\n
Gordon Hayward
\n
BOS
\n
29727900.0
\n
\n
\n
4
\n
5.0
\n
Blake Griffin
\n
DET
\n
29512900.0
\n
\n \n
\n
\n \n \n \n\n \n
\n
\n ","text/plain":" X1 Player Tm season17_18\n0 1.0 Stephen Curry GSW 34682550.0\n1 2.0 LeBron James CLE 33285709.0\n2 3.0 Paul Millsap DEN 31269231.0\n3 4.0 Gordon Hayward BOS 29727900.0\n4 5.0 Blake Griffin DET 29512900.0"},"metadata":{},"execution_count":67}],"execution_count":null},{"cell_type":"code","source":["import pandas as pd\n","con =sqlite3.connect(\"nba_salary.sqlite\")\n","df1=pd.read_sql_query('SELECT * From Seasons_Stats',con)\n","df1"],"metadata":{"id":"uBbLVqvWrXOl","colab":{"height":424,"base_uri":"https://localhost:8080/"},"cell_id":"2dd7f8b8c9644605b981c85d6e15a056","outputId":"8b8a1d14-ffe5-4b45-8786-110988007b20","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":515,"user_tz":300,"timestamp":1646686054000},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/html":"\n
\n
\n
\n\n
\n \n
\n
\n
X1
\n
Year
\n
Player
\n
Pos
\n
Age
\n
Tm
\n
G
\n
GS
\n
MP
\n
PER
\n
...
\n
FT%
\n
ORB
\n
DRB
\n
TRB
\n
AST
\n
STL
\n
BLK
\n
TOV
\n
PF
\n
PTS
\n
\n \n \n
\n
0
\n
0.0
\n
1950.0
\n
Curly Armstrong
\n
G-F
\n
31.0
\n
FTW
\n
63.0
\n
NaN
\n
NaN
\n
NaN
\n
...
\n
0.705
\n
NaN
\n
NaN
\n
NaN
\n
176.0
\n
NaN
\n
NaN
\n
NaN
\n
217.0
\n
458.0
\n
\n
\n
1
\n
1.0
\n
1950.0
\n
Cliff Barker
\n
SG
\n
29.0
\n
INO
\n
49.0
\n
NaN
\n
NaN
\n
NaN
\n
...
\n
0.708
\n
NaN
\n
NaN
\n
NaN
\n
109.0
\n
NaN
\n
NaN
\n
NaN
\n
99.0
\n
279.0
\n
\n
\n
2
\n
2.0
\n
1950.0
\n
Leo Barnhorst
\n
SF
\n
25.0
\n
CHS
\n
67.0
\n
NaN
\n
NaN
\n
NaN
\n
...
\n
0.698
\n
NaN
\n
NaN
\n
NaN
\n
140.0
\n
NaN
\n
NaN
\n
NaN
\n
192.0
\n
438.0
\n
\n
\n
3
\n
3.0
\n
1950.0
\n
Ed Bartels
\n
F
\n
24.0
\n
TOT
\n
15.0
\n
NaN
\n
NaN
\n
NaN
\n
...
\n
0.559
\n
NaN
\n
NaN
\n
NaN
\n
20.0
\n
NaN
\n
NaN
\n
NaN
\n
29.0
\n
63.0
\n
\n
\n
4
\n
4.0
\n
1950.0
\n
Ed Bartels
\n
F
\n
24.0
\n
DNN
\n
13.0
\n
NaN
\n
NaN
\n
NaN
\n
...
\n
0.548
\n
NaN
\n
NaN
\n
NaN
\n
20.0
\n
NaN
\n
NaN
\n
NaN
\n
27.0
\n
59.0
\n
\n
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
\n
\n
24686
\n
24686.0
\n
2017.0
\n
Cody Zeller
\n
PF
\n
24.0
\n
CHO
\n
62.0
\n
NaN
\n
1725.0
\n
16.7
\n
...
\n
0.679
\n
NaN
\n
NaN
\n
405.0
\n
99.0
\n
NaN
\n
NaN
\n
NaN
\n
189.0
\n
639.0
\n
\n
\n
24687
\n
24687.0
\n
2017.0
\n
Tyler Zeller
\n
C
\n
27.0
\n
BOS
\n
51.0
\n
NaN
\n
525.0
\n
13.0
\n
...
\n
0.564
\n
NaN
\n
NaN
\n
124.0
\n
42.0
\n
NaN
\n
NaN
\n
NaN
\n
61.0
\n
178.0
\n
\n
\n
24688
\n
24688.0
\n
2017.0
\n
Stephen Zimmerman
\n
C
\n
20.0
\n
ORL
\n
19.0
\n
0.0
\n
108.0
\n
7.3
\n
...
\n
0.600
\n
NaN
\n
NaN
\n
35.0
\n
4.0
\n
NaN
\n
NaN
\n
NaN
\n
17.0
\n
23.0
\n
\n
\n
24689
\n
24689.0
\n
2017.0
\n
Paul Zipser
\n
SF
\n
22.0
\n
CHI
\n
44.0
\n
NaN
\n
843.0
\n
6.9
\n
...
\n
0.775
\n
NaN
\n
NaN
\n
125.0
\n
36.0
\n
NaN
\n
NaN
\n
NaN
\n
78.0
\n
240.0
\n
\n
\n
24690
\n
24690.0
\n
2017.0
\n
Ivica Zubac
\n
C
\n
19.0
\n
LAL
\n
38.0
\n
NaN
\n
609.0
\n
17.0
\n
...
\n
0.653
\n
NaN
\n
NaN
\n
159.0
\n
30.0
\n
NaN
\n
NaN
\n
NaN
\n
66.0
\n
284.0
\n
\n \n
\n
24691 rows × 53 columns
\n
\n \n \n \n\n \n
\n
\n ","text/plain":" X1 Year Player Pos Age Tm G GS MP \\\n0 0.0 1950.0 Curly Armstrong G-F 31.0 FTW 63.0 NaN NaN \n1 1.0 1950.0 Cliff Barker SG 29.0 INO 49.0 NaN NaN \n2 2.0 1950.0 Leo Barnhorst SF 25.0 CHS 67.0 NaN NaN \n3 3.0 1950.0 Ed Bartels F 24.0 TOT 15.0 NaN NaN \n4 4.0 1950.0 Ed Bartels F 24.0 DNN 13.0 NaN NaN \n... ... ... ... ... ... ... ... ... ... \n24686 24686.0 2017.0 Cody Zeller PF 24.0 CHO 62.0 NaN 1725.0 \n24687 24687.0 2017.0 Tyler Zeller C 27.0 BOS 51.0 NaN 525.0 \n24688 24688.0 2017.0 Stephen Zimmerman C 20.0 ORL 19.0 0.0 108.0 \n24689 24689.0 2017.0 Paul Zipser SF 22.0 CHI 44.0 NaN 843.0 \n24690 24690.0 2017.0 Ivica Zubac C 19.0 LAL 38.0 NaN 609.0 \n\n PER ... FT% ORB DRB TRB AST STL BLK TOV PF PTS \n0 NaN ... 0.705 NaN NaN NaN 176.0 NaN NaN NaN 217.0 458.0 \n1 NaN ... 0.708 NaN NaN NaN 109.0 NaN NaN NaN 99.0 279.0 \n2 NaN ... 0.698 NaN NaN NaN 140.0 NaN NaN NaN 192.0 438.0 \n3 NaN ... 0.559 NaN NaN NaN 20.0 NaN NaN NaN 29.0 63.0 \n4 NaN ... 0.548 NaN NaN NaN 20.0 NaN NaN NaN 27.0 59.0 \n... ... ... ... ... ... ... ... ... ... ... ... ... \n24686 16.7 ... 0.679 NaN NaN 405.0 99.0 NaN NaN NaN 189.0 639.0 \n24687 13.0 ... 0.564 NaN NaN 124.0 42.0 NaN NaN NaN 61.0 178.0 \n24688 7.3 ... 0.600 NaN NaN 35.0 4.0 NaN NaN NaN 17.0 23.0 \n24689 6.9 ... 0.775 NaN NaN 125.0 36.0 NaN NaN NaN 78.0 240.0 \n24690 17.0 ... 0.653 NaN NaN 159.0 30.0 NaN NaN NaN 66.0 284.0 \n\n[24691 rows x 53 columns]"},"metadata":{},"execution_count":68}],"execution_count":null},{"cell_type":"markdown","source":["# Parte 2"],"metadata":{"id":"8BInrsSvrmlK","cell_id":"cd172cc072e74213aee88b4bf1f92d1f","deepnote_cell_type":"markdown"}},{"cell_type":"code","source":["df.isnull().values.any()"],"metadata":{"id":"wT6FWrnBrpYB","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"eeca27e09d41497c9b61a08a2d8e74ec","outputId":"45d35ffd-d034-46dd-db83-1c019fbaf335","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":7,"user_tz":300,"timestamp":1646686055343},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"False"},"metadata":{},"execution_count":69}],"execution_count":null},{"cell_type":"code","source":["df.isnull().sum()"],"metadata":{"id":"0TEmw2OPr73S","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"b6592273aa0946628974a3156df8ee6a","outputId":"7e4dba85-2ee9-422d-b7d9-8b9947c0b37d","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":8,"user_tz":300,"timestamp":1646686056957},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"X1 0\nPlayer 0\nTm 0\nseason17_18 0\ndtype: int64"},"metadata":{},"execution_count":70}],"execution_count":null},{"cell_type":"code","source":["df1.isnull().values.any()"],"metadata":{"id":"tkCNc6twr2hj","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"740b92bd508348afb46ce84f96bc820d","outputId":"00258d80-d42a-4df6-f299-ab9c827e566d","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":4,"user_tz":300,"timestamp":1646686058090},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"True"},"metadata":{},"execution_count":71}],"execution_count":null},{"cell_type":"code","source":["df1.isnull().sum()"],"metadata":{"id":"b-wIt8Dir9Wc","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"192ca4202d5b4f43a1fb5a354502e551","outputId":"8fddb87d-43b5-473c-a7c0-a28f07892622","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":4,"user_tz":300,"timestamp":1646686058438},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"X1 0\nYear 67\nPlayer 67\nPos 67\nAge 75\nTm 67\nG 67\nGS 18444\nMP 553\nPER 590\nTS% 153\n3PAr 21239\nFTr 166\nORB% 23714\nDRB% 24320\nTRB% 24436\nAST% 23926\nSTL% 22672\nBLK% 21652\nTOV% 24241\nUSG% 24633\nblanl 24691\nOWS 106\nDWS 106\nWS 106\nWS/48 590\nblank2 24691\nOBPM 24191\nDBPM 23975\nBPM 24279\nVORP 21604\nFG 67\nFGA 67\nFG% 166\n3P 16021\n3PA 19516\n3P% 20893\n2P 67\n2PA 67\n2P% 195\neFG% 166\nFT 67\nFTA 67\nFT% 925\nORB 23158\nDRB 23956\nTRB 379\nAST 67\nSTL 22794\nBLK 21000\nTOV 23761\nPF 67\nPTS 67\ndtype: int64"},"metadata":{},"execution_count":72}],"execution_count":null},{"cell_type":"code","source":["print(df1.shape)\n","df1_final=df1.dropna(axis=0)# Filas con columas con Nas seran removidas\n","print(df1_final.shape)\n","df1_final.head(10)\n","# ! Esto no funciona!"],"metadata":{"id":"nQdT44FfsTAp","colab":{"height":114,"base_uri":"https://localhost:8080/"},"cell_id":"8356f4c36d0b4f0d9b51b043ef0afc3e","outputId":"b7ca7645-1d51-4722-ffa2-810e328e208e","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":385,"user_tz":300,"timestamp":1646686060976},"deepnote_cell_type":"code"},"outputs":[{"output_type":"stream","name":"stdout","text":"(24691, 53)\n(0, 53)\n"},{"output_type":"execute_result","data":{"text/html":"\n
\n ","text/plain":" X1 Year Player Pos Age Tm G MP PER \\\n0 0.0 1950.0 Curly Armstrong G-F 31.0 FTW 63.0 NaN NaN \n1 1.0 1950.0 Cliff Barker SG 29.0 INO 49.0 NaN NaN \n2 2.0 1950.0 Leo Barnhorst SF 25.0 CHS 67.0 NaN NaN \n3 3.0 1950.0 Ed Bartels F 24.0 TOT 15.0 NaN NaN \n4 4.0 1950.0 Ed Bartels F 24.0 DNN 13.0 NaN NaN \n... ... ... ... ... ... ... ... ... ... \n24686 24686.0 2017.0 Cody Zeller PF 24.0 CHO 62.0 1725.0 16.7 \n24687 24687.0 2017.0 Tyler Zeller C 27.0 BOS 51.0 525.0 13.0 \n24688 24688.0 2017.0 Stephen Zimmerman C 20.0 ORL 19.0 108.0 7.3 \n24689 24689.0 2017.0 Paul Zipser SF 22.0 CHI 44.0 843.0 6.9 \n24690 24690.0 2017.0 Ivica Zubac C 19.0 LAL 38.0 609.0 17.0 \n\n TS% ... 2PA 2P% eFG% FT FTA FT% TRB AST \\\n0 0.368 ... 516.0 0.279 0.279 170.0 241.0 0.705 NaN 176.0 \n1 0.435 ... 274.0 0.372 0.372 75.0 106.0 0.708 NaN 109.0 \n2 0.394 ... 499.0 0.349 0.349 90.0 129.0 0.698 NaN 140.0 \n3 0.312 ... 86.0 0.256 0.256 19.0 34.0 0.559 NaN 20.0 \n4 0.308 ... 82.0 0.256 0.256 17.0 31.0 0.548 NaN 20.0 \n... ... ... ... ... ... ... ... ... ... ... \n24686 0.604 ... 442.0 0.572 0.571 133.0 196.0 0.679 405.0 99.0 \n24687 0.508 ... 157.0 0.497 0.494 22.0 39.0 0.564 124.0 42.0 \n24688 0.346 ... 31.0 0.323 0.323 3.0 5.0 0.600 35.0 4.0 \n24689 0.503 ... 122.0 0.451 0.473 31.0 40.0 0.775 125.0 36.0 \n24690 0.547 ... 235.0 0.536 0.529 32.0 49.0 0.653 159.0 30.0 \n\n PF PTS \n0 217.0 458.0 \n1 99.0 279.0 \n2 192.0 438.0 \n3 29.0 63.0 \n4 27.0 59.0 \n... ... ... \n24686 189.0 639.0 \n24687 61.0 178.0 \n24688 17.0 23.0 \n24689 78.0 240.0 \n24690 66.0 284.0 \n\n[24691 rows x 29 columns]"},"metadata":{},"execution_count":78}],"execution_count":null},{"cell_type":"code","source":["df1_y= df1_x.interpolate()\n","percent_missing_y = df1_y.isnull().sum() * 100 / len(df1_y)\n","percent_missing_y"],"metadata":{"id":"TvUxlxCQu8WD","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"9aac3493711144f5aa0f920103ad709d","outputId":"a9ac14ef-f0c9-4c1c-f77a-a4ee841062d2","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":7,"user_tz":300,"timestamp":1646686074759},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"X1 0.000000\nYear 0.000000\nPlayer 0.271354\nPos 0.271354\nAge 0.000000\nTm 0.271354\nG 0.000000\nMP 1.976429\nPER 1.976429\nTS% 0.000000\nFTr 0.000000\nOWS 0.000000\nDWS 0.000000\nWS 0.000000\nWS/48 1.976429\nFG 0.000000\nFGA 0.000000\nFG% 0.000000\n2P 0.000000\n2PA 0.000000\n2P% 0.000000\neFG% 0.000000\nFT 0.000000\nFTA 0.000000\nFT% 0.000000\nTRB 1.267668\nAST 0.000000\nPF 0.000000\nPTS 0.000000\ndtype: float64"},"metadata":{},"execution_count":79}],"execution_count":null},{"cell_type":"code","source":["df1_y"],"metadata":{"id":"APsNZ8novQcO","colab":{"height":424,"base_uri":"https://localhost:8080/"},"cell_id":"afb2fe9ea71f497cbe848a4906d2522a","outputId":"2d36e8a5-77be-438f-8ee3-22faab1f4e7b","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":465,"user_tz":300,"timestamp":1646686076817},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/html":"\n
\n
\n
\n\n
\n \n
\n
\n
X1
\n
Year
\n
Player
\n
Pos
\n
Age
\n
Tm
\n
G
\n
MP
\n
PER
\n
TS%
\n
...
\n
2PA
\n
2P%
\n
eFG%
\n
FT
\n
FTA
\n
FT%
\n
TRB
\n
AST
\n
PF
\n
PTS
\n
\n \n \n
\n
0
\n
0.0
\n
1950.0
\n
Curly Armstrong
\n
G-F
\n
31.0
\n
FTW
\n
63.0
\n
NaN
\n
NaN
\n
0.368
\n
...
\n
516.0
\n
0.279
\n
0.279
\n
170.0
\n
241.0
\n
0.705
\n
NaN
\n
176.0
\n
217.0
\n
458.0
\n
\n
\n
1
\n
1.0
\n
1950.0
\n
Cliff Barker
\n
SG
\n
29.0
\n
INO
\n
49.0
\n
NaN
\n
NaN
\n
0.435
\n
...
\n
274.0
\n
0.372
\n
0.372
\n
75.0
\n
106.0
\n
0.708
\n
NaN
\n
109.0
\n
99.0
\n
279.0
\n
\n
\n
2
\n
2.0
\n
1950.0
\n
Leo Barnhorst
\n
SF
\n
25.0
\n
CHS
\n
67.0
\n
NaN
\n
NaN
\n
0.394
\n
...
\n
499.0
\n
0.349
\n
0.349
\n
90.0
\n
129.0
\n
0.698
\n
NaN
\n
140.0
\n
192.0
\n
438.0
\n
\n
\n
3
\n
3.0
\n
1950.0
\n
Ed Bartels
\n
F
\n
24.0
\n
TOT
\n
15.0
\n
NaN
\n
NaN
\n
0.312
\n
...
\n
86.0
\n
0.256
\n
0.256
\n
19.0
\n
34.0
\n
0.559
\n
NaN
\n
20.0
\n
29.0
\n
63.0
\n
\n
\n
4
\n
4.0
\n
1950.0
\n
Ed Bartels
\n
F
\n
24.0
\n
DNN
\n
13.0
\n
NaN
\n
NaN
\n
0.308
\n
...
\n
82.0
\n
0.256
\n
0.256
\n
17.0
\n
31.0
\n
0.548
\n
NaN
\n
20.0
\n
27.0
\n
59.0
\n
\n
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
\n
\n
24686
\n
24686.0
\n
2017.0
\n
Cody Zeller
\n
PF
\n
24.0
\n
CHO
\n
62.0
\n
1725.0
\n
16.7
\n
0.604
\n
...
\n
442.0
\n
0.572
\n
0.571
\n
133.0
\n
196.0
\n
0.679
\n
405.0
\n
99.0
\n
189.0
\n
639.0
\n
\n
\n
24687
\n
24687.0
\n
2017.0
\n
Tyler Zeller
\n
C
\n
27.0
\n
BOS
\n
51.0
\n
525.0
\n
13.0
\n
0.508
\n
...
\n
157.0
\n
0.497
\n
0.494
\n
22.0
\n
39.0
\n
0.564
\n
124.0
\n
42.0
\n
61.0
\n
178.0
\n
\n
\n
24688
\n
24688.0
\n
2017.0
\n
Stephen Zimmerman
\n
C
\n
20.0
\n
ORL
\n
19.0
\n
108.0
\n
7.3
\n
0.346
\n
...
\n
31.0
\n
0.323
\n
0.323
\n
3.0
\n
5.0
\n
0.600
\n
35.0
\n
4.0
\n
17.0
\n
23.0
\n
\n
\n
24689
\n
24689.0
\n
2017.0
\n
Paul Zipser
\n
SF
\n
22.0
\n
CHI
\n
44.0
\n
843.0
\n
6.9
\n
0.503
\n
...
\n
122.0
\n
0.451
\n
0.473
\n
31.0
\n
40.0
\n
0.775
\n
125.0
\n
36.0
\n
78.0
\n
240.0
\n
\n
\n
24690
\n
24690.0
\n
2017.0
\n
Ivica Zubac
\n
C
\n
19.0
\n
LAL
\n
38.0
\n
609.0
\n
17.0
\n
0.547
\n
...
\n
235.0
\n
0.536
\n
0.529
\n
32.0
\n
49.0
\n
0.653
\n
159.0
\n
30.0
\n
66.0
\n
284.0
\n
\n \n
\n
24691 rows × 29 columns
\n
\n \n \n \n\n \n
\n
\n ","text/plain":" X1 Year Player Pos Age Tm G MP PER \\\n0 0.0 1950.0 Curly Armstrong G-F 31.0 FTW 63.0 NaN NaN \n1 1.0 1950.0 Cliff Barker SG 29.0 INO 49.0 NaN NaN \n2 2.0 1950.0 Leo Barnhorst SF 25.0 CHS 67.0 NaN NaN \n3 3.0 1950.0 Ed Bartels F 24.0 TOT 15.0 NaN NaN \n4 4.0 1950.0 Ed Bartels F 24.0 DNN 13.0 NaN NaN \n... ... ... ... ... ... ... ... ... ... \n24686 24686.0 2017.0 Cody Zeller PF 24.0 CHO 62.0 1725.0 16.7 \n24687 24687.0 2017.0 Tyler Zeller C 27.0 BOS 51.0 525.0 13.0 \n24688 24688.0 2017.0 Stephen Zimmerman C 20.0 ORL 19.0 108.0 7.3 \n24689 24689.0 2017.0 Paul Zipser SF 22.0 CHI 44.0 843.0 6.9 \n24690 24690.0 2017.0 Ivica Zubac C 19.0 LAL 38.0 609.0 17.0 \n\n TS% ... 2PA 2P% eFG% FT FTA FT% TRB AST \\\n0 0.368 ... 516.0 0.279 0.279 170.0 241.0 0.705 NaN 176.0 \n1 0.435 ... 274.0 0.372 0.372 75.0 106.0 0.708 NaN 109.0 \n2 0.394 ... 499.0 0.349 0.349 90.0 129.0 0.698 NaN 140.0 \n3 0.312 ... 86.0 0.256 0.256 19.0 34.0 0.559 NaN 20.0 \n4 0.308 ... 82.0 0.256 0.256 17.0 31.0 0.548 NaN 20.0 \n... ... ... ... ... ... ... ... ... ... ... \n24686 0.604 ... 442.0 0.572 0.571 133.0 196.0 0.679 405.0 99.0 \n24687 0.508 ... 157.0 0.497 0.494 22.0 39.0 0.564 124.0 42.0 \n24688 0.346 ... 31.0 0.323 0.323 3.0 5.0 0.600 35.0 4.0 \n24689 0.503 ... 122.0 0.451 0.473 31.0 40.0 0.775 125.0 36.0 \n24690 0.547 ... 235.0 0.536 0.529 32.0 49.0 0.653 159.0 30.0 \n\n PF PTS \n0 217.0 458.0 \n1 99.0 279.0 \n2 192.0 438.0 \n3 29.0 63.0 \n4 27.0 59.0 \n... ... ... \n24686 189.0 639.0 \n24687 61.0 178.0 \n24688 17.0 23.0 \n24689 78.0 240.0 \n24690 66.0 284.0 \n\n[24691 rows x 29 columns]"},"metadata":{},"execution_count":80}],"execution_count":null},{"cell_type":"markdown","source":["# Parte 3"],"metadata":{"id":"f08N9AjevSHe","cell_id":"1e917942490840409a445d49e1af437c","deepnote_cell_type":"markdown"}},{"cell_type":"code","source":["con =sqlite3.connect(\"nba_salary.sqlite\")\n","df=pd.read_sql_query('SELECT * FROM NBA_season1718_salary',con)\n","df.head()"],"metadata":{"id":"kLZa8GLnvT89","colab":{"height":206,"base_uri":"https://localhost:8080/"},"cell_id":"8d68457428b7442e8d5b139d19f65433","outputId":"f0cf7664-59b7-4de2-8ec3-658e61bbe684","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":12,"user_tz":300,"timestamp":1646686077679},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/html":"\n
\n
\n
\n\n
\n \n
\n
\n
X1
\n
Player
\n
Tm
\n
season17_18
\n
\n \n \n
\n
0
\n
1.0
\n
Stephen Curry
\n
GSW
\n
34682550.0
\n
\n
\n
1
\n
2.0
\n
LeBron James
\n
CLE
\n
33285709.0
\n
\n
\n
2
\n
3.0
\n
Paul Millsap
\n
DEN
\n
31269231.0
\n
\n
\n
3
\n
4.0
\n
Gordon Hayward
\n
BOS
\n
29727900.0
\n
\n
\n
4
\n
5.0
\n
Blake Griffin
\n
DET
\n
29512900.0
\n
\n \n
\n
\n \n \n \n\n \n
\n
\n ","text/plain":" X1 Player Tm season17_18\n0 1.0 Stephen Curry GSW 34682550.0\n1 2.0 LeBron James CLE 33285709.0\n2 3.0 Paul Millsap DEN 31269231.0\n3 4.0 Gordon Hayward BOS 29727900.0\n4 5.0 Blake Griffin DET 29512900.0"},"metadata":{},"execution_count":81}],"execution_count":null},{"cell_type":"code","source":["import pandas as pd\n","con =sqlite3.connect(\"nba_salary.sqlite\")\n","df1=pd.read_sql_query('SELECT * From Seasons_Stats',con)\n","df1=df1[df1.Year == 2017]\n","df1"],"metadata":{"id":"V7xha67OveGC","colab":{"height":424,"base_uri":"https://localhost:8080/"},"cell_id":"5f08eebaccd0448283f0ac43c2fef939","outputId":"a49544e0-0995-4df2-daaa-78fc3e1c12ce","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":510,"user_tz":300,"timestamp":1646686079984},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/html":"\n
\n
\n
\n\n
\n \n
\n
\n
X1
\n
Year
\n
Player
\n
Pos
\n
Age
\n
Tm
\n
G
\n
GS
\n
MP
\n
PER
\n
...
\n
FT%
\n
ORB
\n
DRB
\n
TRB
\n
AST
\n
STL
\n
BLK
\n
TOV
\n
PF
\n
PTS
\n
\n \n \n
\n
24096
\n
24096.0
\n
2017.0
\n
Alex Abrines
\n
SG
\n
23.0
\n
OKC
\n
68.0
\n
NaN
\n
1055.0
\n
10.1
\n
...
\n
0.898
\n
NaN
\n
NaN
\n
86.0
\n
40.0
\n
NaN
\n
NaN
\n
NaN
\n
114.0
\n
406.0
\n
\n
\n
24097
\n
24097.0
\n
2017.0
\n
Quincy Acy
\n
PF
\n
26.0
\n
TOT
\n
38.0
\n
1.0
\n
558.0
\n
11.8
\n
...
\n
0.750
\n
NaN
\n
NaN
\n
115.0
\n
18.0
\n
NaN
\n
NaN
\n
NaN
\n
67.0
\n
222.0
\n
\n
\n
24098
\n
24098.0
\n
2017.0
\n
Quincy Acy
\n
PF
\n
26.0
\n
DAL
\n
6.0
\n
0.0
\n
48.0
\n
-1.4
\n
...
\n
0.667
\n
NaN
\n
NaN
\n
8.0
\n
0.0
\n
0.0
\n
0.0
\n
NaN
\n
9.0
\n
13.0
\n
\n
\n
24099
\n
24099.0
\n
2017.0
\n
Quincy Acy
\n
PF
\n
26.0
\n
BRK
\n
32.0
\n
1.0
\n
510.0
\n
13.1
\n
...
\n
0.754
\n
NaN
\n
NaN
\n
107.0
\n
18.0
\n
NaN
\n
NaN
\n
NaN
\n
58.0
\n
209.0
\n
\n
\n
24100
\n
24100.0
\n
2017.0
\n
Steven Adams
\n
C
\n
23.0
\n
OKC
\n
80.0
\n
NaN
\n
2389.0
\n
16.5
\n
...
\n
0.611
\n
NaN
\n
NaN
\n
615.0
\n
86.0
\n
NaN
\n
NaN
\n
NaN
\n
195.0
\n
905.0
\n
\n
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
\n
\n
24686
\n
24686.0
\n
2017.0
\n
Cody Zeller
\n
PF
\n
24.0
\n
CHO
\n
62.0
\n
NaN
\n
1725.0
\n
16.7
\n
...
\n
0.679
\n
NaN
\n
NaN
\n
405.0
\n
99.0
\n
NaN
\n
NaN
\n
NaN
\n
189.0
\n
639.0
\n
\n
\n
24687
\n
24687.0
\n
2017.0
\n
Tyler Zeller
\n
C
\n
27.0
\n
BOS
\n
51.0
\n
NaN
\n
525.0
\n
13.0
\n
...
\n
0.564
\n
NaN
\n
NaN
\n
124.0
\n
42.0
\n
NaN
\n
NaN
\n
NaN
\n
61.0
\n
178.0
\n
\n
\n
24688
\n
24688.0
\n
2017.0
\n
Stephen Zimmerman
\n
C
\n
20.0
\n
ORL
\n
19.0
\n
0.0
\n
108.0
\n
7.3
\n
...
\n
0.600
\n
NaN
\n
NaN
\n
35.0
\n
4.0
\n
NaN
\n
NaN
\n
NaN
\n
17.0
\n
23.0
\n
\n
\n
24689
\n
24689.0
\n
2017.0
\n
Paul Zipser
\n
SF
\n
22.0
\n
CHI
\n
44.0
\n
NaN
\n
843.0
\n
6.9
\n
...
\n
0.775
\n
NaN
\n
NaN
\n
125.0
\n
36.0
\n
NaN
\n
NaN
\n
NaN
\n
78.0
\n
240.0
\n
\n
\n
24690
\n
24690.0
\n
2017.0
\n
Ivica Zubac
\n
C
\n
19.0
\n
LAL
\n
38.0
\n
NaN
\n
609.0
\n
17.0
\n
...
\n
0.653
\n
NaN
\n
NaN
\n
159.0
\n
30.0
\n
NaN
\n
NaN
\n
NaN
\n
66.0
\n
284.0
\n
\n \n
\n
595 rows × 53 columns
\n
\n \n \n \n\n \n
\n
\n ","text/plain":" X1 Year Player Pos Age Tm G GS MP \\\n24096 24096.0 2017.0 Alex Abrines SG 23.0 OKC 68.0 NaN 1055.0 \n24097 24097.0 2017.0 Quincy Acy PF 26.0 TOT 38.0 1.0 558.0 \n24098 24098.0 2017.0 Quincy Acy PF 26.0 DAL 6.0 0.0 48.0 \n24099 24099.0 2017.0 Quincy Acy PF 26.0 BRK 32.0 1.0 510.0 \n24100 24100.0 2017.0 Steven Adams C 23.0 OKC 80.0 NaN 2389.0 \n... ... ... ... .. ... ... ... ... ... \n24686 24686.0 2017.0 Cody Zeller PF 24.0 CHO 62.0 NaN 1725.0 \n24687 24687.0 2017.0 Tyler Zeller C 27.0 BOS 51.0 NaN 525.0 \n24688 24688.0 2017.0 Stephen Zimmerman C 20.0 ORL 19.0 0.0 108.0 \n24689 24689.0 2017.0 Paul Zipser SF 22.0 CHI 44.0 NaN 843.0 \n24690 24690.0 2017.0 Ivica Zubac C 19.0 LAL 38.0 NaN 609.0 \n\n PER ... FT% ORB DRB TRB AST STL BLK TOV PF PTS \n24096 10.1 ... 0.898 NaN NaN 86.0 40.0 NaN NaN NaN 114.0 406.0 \n24097 11.8 ... 0.750 NaN NaN 115.0 18.0 NaN NaN NaN 67.0 222.0 \n24098 -1.4 ... 0.667 NaN NaN 8.0 0.0 0.0 0.0 NaN 9.0 13.0 \n24099 13.1 ... 0.754 NaN NaN 107.0 18.0 NaN NaN NaN 58.0 209.0 \n24100 16.5 ... 0.611 NaN NaN 615.0 86.0 NaN NaN NaN 195.0 905.0 \n... ... ... ... ... ... ... ... ... ... ... ... ... \n24686 16.7 ... 0.679 NaN NaN 405.0 99.0 NaN NaN NaN 189.0 639.0 \n24687 13.0 ... 0.564 NaN NaN 124.0 42.0 NaN NaN NaN 61.0 178.0 \n24688 7.3 ... 0.600 NaN NaN 35.0 4.0 NaN NaN NaN 17.0 23.0 \n24689 6.9 ... 0.775 NaN NaN 125.0 36.0 NaN NaN NaN 78.0 240.0 \n24690 17.0 ... 0.653 NaN NaN 159.0 30.0 NaN NaN NaN 66.0 284.0 \n\n[595 rows x 53 columns]"},"metadata":{},"execution_count":82}],"execution_count":null},{"cell_type":"markdown","source":["## Encontrar los duplicados"],"metadata":{"id":"tweh_ZohvrWM","cell_id":"ccd2f6a39986467fa8b70ff1d043903f","deepnote_cell_type":"markdown"}},{"cell_type":"code","source":["df.Player.duplicated()"],"metadata":{"id":"qSe0hEccv413","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"4f984f2577404896a9cd4fa8f679bf4e","outputId":"3a8317c6-8397-4216-ece7-6f0acb60b434","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":7,"user_tz":300,"timestamp":1646686081010},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"0 False\n1 False\n2 False\n3 False\n4 False\n ... \n568 True\n569 False\n570 False\n571 True\n572 True\nName: Player, Length: 573, dtype: bool"},"metadata":{},"execution_count":83}],"execution_count":null},{"cell_type":"code","source":["df.Player.duplicated().sum()"],"metadata":{"id":"xEOK-0T9v-tk","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"c018df167986409394c6d180c536db94","outputId":"f1b10f06-9b61-4914-e416-7d99339bde25","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":4,"user_tz":300,"timestamp":1646686082553},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"38"},"metadata":{},"execution_count":84}],"execution_count":null},{"cell_type":"code","source":["df.loc[df.Player.duplicated(),:].sort_values(by='Player')"],"metadata":{"id":"YsxY-Te8wFe_","colab":{"height":1000,"base_uri":"https://localhost:8080/"},"cell_id":"387de4e5fafb47069f33945c44283ff2","outputId":"aa3ab61a-88f9-4989-bfc9-92a7a17c66fa","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":371,"user_tz":300,"timestamp":1646686083356},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/html":"\n
\n
\n
\n\n
\n \n
\n
\n
X1
\n
Player
\n
Tm
\n
season17_18
\n
\n \n \n
\n
331
\n
332.0
\n
Anthony Tolliver
\n
SAC
\n
2000000.0
\n
\n
\n
555
\n
556.0
\n
Antonius Cleveland
\n
DAL
\n
50000.0
\n
\n
\n
377
\n
378.0
\n
Arron Afflalo
\n
SAC
\n
1500000.0
\n
\n
\n
552
\n
553.0
\n
Briante Weber
\n
HOU
\n
50000.0
\n
\n
\n
550
\n
551.0
\n
Briante Weber
\n
LAL
\n
50000.0
\n
\n
\n
503
\n
504.0
\n
DeAndre Liggins
\n
NOP
\n
172238.0
\n
\n
\n
566
\n
567.0
\n
DeAndre Liggins
\n
ATL
\n
26773.0
\n
\n
\n
528
\n
529.0
\n
Demetrius Jackson
\n
HOU
\n
74159.0
\n
\n
\n
535
\n
536.0
\n
Demetrius Jackson
\n
HOU
\n
50000.0
\n
\n
\n
556
\n
557.0
\n
Diamond Stone
\n
CHI
\n
50000.0
\n
\n
\n
297
\n
298.0
\n
Dwyane Wade
\n
MIA
\n
2328652.0
\n
\n
\n
487
\n
488.0
\n
Ersan Ilyasova
\n
PHI
\n
502328.0
\n
\n
\n
529
\n
530.0
\n
Georgios Papagiannis
\n
POR
\n
74159.0
\n
\n
\n
201
\n
202.0
\n
Greg Monroe
\n
BOS
\n
5000000.0
\n
\n
\n
501
\n
502.0
\n
Isaiah Canaan
\n
CHI
\n
200000.0
\n
\n
\n
532
\n
533.0
\n
Isaiah Canaan
\n
HOU
\n
53465.0
\n
\n
\n
216
\n
217.0
\n
Jamal Crawford
\n
MIN
\n
4328000.0
\n
\n
\n
305
\n
306.0
\n
Jameer Nelson
\n
DET
\n
2262871.0
\n
\n
\n
526
\n
527.0
\n
Jarell Eddie
\n
CHI
\n
83129.0
\n
\n
\n
572
\n
573.0
\n
Jarell Eddie
\n
CHI
\n
17224.0
\n
\n
\n
481
\n
482.0
\n
Joe Johnson
\n
HOU
\n
749905.0
\n
\n
\n
571
\n
572.0
\n
Joel Bolomboy
\n
MIL
\n
22248.0
\n
\n
\n
311
\n
312.0
\n
Josh Smith
\n
NOP
\n
2183934.0
\n
\n
\n
534
\n
535.0
\n
Kyle Collinsworth
\n
DAL
\n
50000.0
\n
\n
\n
480
\n
481.0
\n
Marco Belinelli
\n
PHI
\n
776217.0
\n
\n
\n
539
\n
540.0
\n
Naz Mitrou-Long
\n
UTA
\n
50000.0
\n
\n
\n
559
\n
560.0
\n
Nigel Hayes
\n
LAL
\n
46080.0
\n
\n
\n
560
\n
561.0
\n
Nigel Hayes
\n
TOR
\n
46080.0
\n
\n
\n
568
\n
569.0
\n
Quinn Cook
\n
NOP
\n
25000.0
\n
\n
\n
260
\n
261.0
\n
Rajon Rondo
\n
CHI
\n
3000000.0
\n
\n
\n
497
\n
498.0
\n
Ramon Sessions
\n
WAS
\n
263124.0
\n
\n
\n
505
\n
506.0
\n
Rashad Vaughn
\n
ORL
\n
166258.0
\n
\n
\n
299
\n
300.0
\n
Richard Jefferson
\n
DEN
\n
2328652.0
\n
\n
\n
477
\n
478.0
\n
Sean Kilpatrick
\n
MIL
\n
789725.0
\n
\n
\n
504
\n
505.0
\n
Sean Kilpatrick
\n
LAC
\n
172238.0
\n
\n
\n
506
\n
507.0
\n
Troy Williams
\n
NYK
\n
148318.0
\n
\n
\n
533
\n
534.0
\n
Tyler Cavanaugh
\n
ATL
\n
50000.0
\n
\n
\n
500
\n
501.0
\n
Wade Baldwin
\n
POR
\n
222476.0
\n
\n \n
\n
\n \n \n \n\n \n
\n
\n ","text/plain":" X1 Player Tm season17_18\n331 332.0 Anthony Tolliver SAC 2000000.0\n555 556.0 Antonius Cleveland DAL 50000.0\n377 378.0 Arron Afflalo SAC 1500000.0\n552 553.0 Briante Weber HOU 50000.0\n550 551.0 Briante Weber LAL 50000.0\n503 504.0 DeAndre Liggins NOP 172238.0\n566 567.0 DeAndre Liggins ATL 26773.0\n528 529.0 Demetrius Jackson HOU 74159.0\n535 536.0 Demetrius Jackson HOU 50000.0\n556 557.0 Diamond Stone CHI 50000.0\n297 298.0 Dwyane Wade MIA 2328652.0\n487 488.0 Ersan Ilyasova PHI 502328.0\n529 530.0 Georgios Papagiannis POR 74159.0\n201 202.0 Greg Monroe BOS 5000000.0\n501 502.0 Isaiah Canaan CHI 200000.0\n532 533.0 Isaiah Canaan HOU 53465.0\n216 217.0 Jamal Crawford MIN 4328000.0\n305 306.0 Jameer Nelson DET 2262871.0\n526 527.0 Jarell Eddie CHI 83129.0\n572 573.0 Jarell Eddie CHI 17224.0\n481 482.0 Joe Johnson HOU 749905.0\n571 572.0 Joel Bolomboy MIL 22248.0\n311 312.0 Josh Smith NOP 2183934.0\n534 535.0 Kyle Collinsworth DAL 50000.0\n480 481.0 Marco Belinelli PHI 776217.0\n539 540.0 Naz Mitrou-Long UTA 50000.0\n559 560.0 Nigel Hayes LAL 46080.0\n560 561.0 Nigel Hayes TOR 46080.0\n568 569.0 Quinn Cook NOP 25000.0\n260 261.0 Rajon Rondo CHI 3000000.0\n497 498.0 Ramon Sessions WAS 263124.0\n505 506.0 Rashad Vaughn ORL 166258.0\n299 300.0 Richard Jefferson DEN 2328652.0\n477 478.0 Sean Kilpatrick MIL 789725.0\n504 505.0 Sean Kilpatrick LAC 172238.0\n506 507.0 Troy Williams NYK 148318.0\n533 534.0 Tyler Cavanaugh ATL 50000.0\n500 501.0 Wade Baldwin POR 222476.0"},"metadata":{},"execution_count":85}],"execution_count":null},{"cell_type":"code","source":["df1.Player.duplicated()"],"metadata":{"id":"VLjKA98ivtID","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"acd0a7ae8d18425f8c6760964d3e2625","outputId":"8417a369-d28a-4b51-d257-ed6f8ca62ee7","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":397,"user_tz":300,"timestamp":1646686085903},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"24096 False\n24097 False\n24098 True\n24099 True\n24100 False\n ... \n24686 False\n24687 False\n24688 False\n24689 False\n24690 False\nName: Player, Length: 595, dtype: bool"},"metadata":{},"execution_count":86}],"execution_count":null},{"cell_type":"code","source":["df1.Player.duplicated().sum()"],"metadata":{"id":"XHcWS5dLvzkS","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"ecac231c5e434b90a2fd91c40710251e","outputId":"d3dd789b-47ad-4a12-96fe-afced5070c6d","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":5,"user_tz":300,"timestamp":1646686086254},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"109"},"metadata":{},"execution_count":87}],"execution_count":null},{"cell_type":"code","source":["df1.loc[df1.Player.duplicated(),:].sort_values(by='Player')"],"metadata":{"id":"iwtQohfMwhIb","colab":{"height":424,"base_uri":"https://localhost:8080/"},"cell_id":"739d408063434e4aa10e42beccd1da6f","outputId":"b9271962-1358-48b7-b000-c7eea43579fd","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":358,"user_tz":300,"timestamp":1646686088726},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/html":"\n
\n
\n
\n\n
\n \n
\n
\n
X1
\n
Year
\n
Player
\n
Pos
\n
Age
\n
Tm
\n
G
\n
GS
\n
MP
\n
PER
\n
...
\n
FT%
\n
ORB
\n
DRB
\n
TRB
\n
AST
\n
STL
\n
BLK
\n
TOV
\n
PF
\n
PTS
\n
\n \n \n
\n
24155
\n
24155.0
\n
2017.0
\n
Andrew Bogut
\n
C
\n
32.0
\n
DAL
\n
26.0
\n
NaN
\n
582.0
\n
9.4
\n
...
\n
0.273
\n
NaN
\n
NaN
\n
218.0
\n
49.0
\n
NaN
\n
NaN
\n
NaN
\n
84.0
\n
79.0
\n
\n
\n
24156
\n
24156.0
\n
2017.0
\n
Andrew Bogut
\n
C
\n
32.0
\n
CLE
\n
1.0
\n
0.0
\n
1.0
\n
-35.3
\n
...
\n
NaN
\n
0.0
\n
0.0
\n
0.0
\n
0.0
\n
0.0
\n
0.0
\n
0.0
\n
2.0
\n
0.0
\n
\n
\n
24492
\n
24492.0
\n
2017.0
\n
Andrew Nicholson
\n
PF
\n
27.0
\n
BRK
\n
10.0
\n
0.0
\n
111.0
\n
5.0
\n
...
\n
1.000
\n
NaN
\n
NaN
\n
27.0
\n
3.0
\n
NaN
\n
0.0
\n
NaN
\n
18.0
\n
30.0
\n
\n
\n
24491
\n
24491.0
\n
2017.0
\n
Andrew Nicholson
\n
PF
\n
27.0
\n
WAS
\n
28.0
\n
0.0
\n
231.0
\n
6.3
\n
...
\n
0.583
\n
NaN
\n
NaN
\n
34.0
\n
7.0
\n
NaN
\n
NaN
\n
NaN
\n
37.0
\n
70.0
\n
\n
\n
24167
\n
24167.0
\n
2017.0
\n
Anthony Brown
\n
SF
\n
24.0
\n
NOP
\n
9.0
\n
0.0
\n
143.0
\n
5.9
\n
...
\n
NaN
\n
NaN
\n
NaN
\n
26.0
\n
6.0
\n
NaN
\n
1.0
\n
NaN
\n
13.0
\n
34.0
\n
\n
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
\n
\n
24250
\n
24250.0
\n
2017.0
\n
Tyreke Evans
\n
SF
\n
27.0
\n
NOP
\n
26.0
\n
0.0
\n
474.0
\n
15.8
\n
...
\n
0.776
\n
NaN
\n
NaN
\n
86.0
\n
91.0
\n
NaN
\n
NaN
\n
NaN
\n
41.0
\n
248.0
\n
\n
\n
24581
\n
24581.0
\n
2017.0
\n
Wayne Selden
\n
SG
\n
22.0
\n
MEM
\n
11.0
\n
NaN
\n
189.0
\n
6.2
\n
...
\n
0.667
\n
1.0
\n
NaN
\n
11.0
\n
12.0
\n
NaN
\n
1.0
\n
NaN
\n
12.0
\n
55.0
\n
\n
\n
24580
\n
24580.0
\n
2017.0
\n
Wayne Selden
\n
SG
\n
22.0
\n
NOP
\n
3.0
\n
NaN
\n
47.0
\n
10.0
\n
...
\n
0.500
\n
0.0
\n
NaN
\n
5.0
\n
1.0
\n
NaN
\n
0.0
\n
NaN
\n
6.0
\n
16.0
\n
\n
\n
24261
\n
24261.0
\n
2017.0
\n
Yogi Ferrell
\n
PG
\n
23.0
\n
DAL
\n
36.0
\n
NaN
\n
1046.0
\n
14.1
\n
...
\n
0.877
\n
NaN
\n
NaN
\n
99.0
\n
155.0
\n
NaN
\n
NaN
\n
NaN
\n
79.0
\n
408.0
\n
\n
\n
24260
\n
24260.0
\n
2017.0
\n
Yogi Ferrell
\n
PG
\n
23.0
\n
BRK
\n
10.0
\n
0.0
\n
151.0
\n
6.5
\n
...
\n
0.625
\n
NaN
\n
NaN
\n
12.0
\n
17.0
\n
NaN
\n
NaN
\n
NaN
\n
11.0
\n
54.0
\n
\n \n
\n
109 rows × 53 columns
\n
\n \n \n \n\n \n
\n
\n ","text/plain":" X1 Year Player Pos Age Tm G GS MP \\\n24155 24155.0 2017.0 Andrew Bogut C 32.0 DAL 26.0 NaN 582.0 \n24156 24156.0 2017.0 Andrew Bogut C 32.0 CLE 1.0 0.0 1.0 \n24492 24492.0 2017.0 Andrew Nicholson PF 27.0 BRK 10.0 0.0 111.0 \n24491 24491.0 2017.0 Andrew Nicholson PF 27.0 WAS 28.0 0.0 231.0 \n24167 24167.0 2017.0 Anthony Brown SF 24.0 NOP 9.0 0.0 143.0 \n... ... ... ... .. ... ... ... ... ... \n24250 24250.0 2017.0 Tyreke Evans SF 27.0 NOP 26.0 0.0 474.0 \n24581 24581.0 2017.0 Wayne Selden SG 22.0 MEM 11.0 NaN 189.0 \n24580 24580.0 2017.0 Wayne Selden SG 22.0 NOP 3.0 NaN 47.0 \n24261 24261.0 2017.0 Yogi Ferrell PG 23.0 DAL 36.0 NaN 1046.0 \n24260 24260.0 2017.0 Yogi Ferrell PG 23.0 BRK 10.0 0.0 151.0 \n\n PER ... FT% ORB DRB TRB AST STL BLK TOV PF PTS \n24155 9.4 ... 0.273 NaN NaN 218.0 49.0 NaN NaN NaN 84.0 79.0 \n24156 -35.3 ... NaN 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2.0 0.0 \n24492 5.0 ... 1.000 NaN NaN 27.0 3.0 NaN 0.0 NaN 18.0 30.0 \n24491 6.3 ... 0.583 NaN NaN 34.0 7.0 NaN NaN NaN 37.0 70.0 \n24167 5.9 ... NaN NaN NaN 26.0 6.0 NaN 1.0 NaN 13.0 34.0 \n... ... ... ... ... ... ... ... ... ... ... ... ... \n24250 15.8 ... 0.776 NaN NaN 86.0 91.0 NaN NaN NaN 41.0 248.0 \n24581 6.2 ... 0.667 1.0 NaN 11.0 12.0 NaN 1.0 NaN 12.0 55.0 \n24580 10.0 ... 0.500 0.0 NaN 5.0 1.0 NaN 0.0 NaN 6.0 16.0 \n24261 14.1 ... 0.877 NaN NaN 99.0 155.0 NaN NaN NaN 79.0 408.0 \n24260 6.5 ... 0.625 NaN NaN 12.0 17.0 NaN NaN NaN 11.0 54.0 \n\n[109 rows x 53 columns]"},"metadata":{},"execution_count":88}],"execution_count":null},{"cell_type":"markdown","source":["Parece ser que los jugadores dentro de la misma temporada pueden cambiar de Equipo y eso hace que aparezcan con diferentes registros"],"metadata":{"id":"aAhAuxeBwoVu","cell_id":"629d85385f8e4047a9b193e368a7743f","deepnote_cell_type":"markdown"}},{"cell_type":"markdown","source":["# Parte 4"],"metadata":{"id":"8hzqWckDwxYG","cell_id":"cb5e44ce53ae40199e06827bcce6e2b2","deepnote_cell_type":"markdown"}},{"cell_type":"markdown","source":["print(df.columns)"],"metadata":{"id":"o-yxZQ3nxNFm","cell_id":"8e764429212346b2b133a25356e93077","deepnote_cell_type":"markdown"}},{"cell_type":"code","source":["print(df.columns)\n","print(df1.columns)"],"metadata":{"id":"rKvWtVzFxPTT","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"af6fbc5b8bb148b8910b02d1f614e2d3","outputId":"a6440cf0-4ca5-4c8c-ca20-840b4af15e82","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":361,"user_tz":300,"timestamp":1646686091192},"deepnote_cell_type":"code"},"outputs":[{"output_type":"stream","name":"stdout","text":"Index(['X1', 'Player', 'Tm', 'season17_18'], dtype='object')\nIndex(['X1', 'Year', 'Player', 'Pos', 'Age', 'Tm', 'G', 'GS', 'MP', 'PER',\n 'TS%', '3PAr', 'FTr', 'ORB%', 'DRB%', 'TRB%', 'AST%', 'STL%', 'BLK%',\n 'TOV%', 'USG%', 'blanl', 'OWS', 'DWS', 'WS', 'WS/48', 'blank2', 'OBPM',\n 'DBPM', 'BPM', 'VORP', 'FG', 'FGA', 'FG%', '3P', '3PA', '3P%', '2P',\n '2PA', '2P%', 'eFG%', 'FT', 'FTA', 'FT%', 'ORB', 'DRB', 'TRB', 'AST',\n 'STL', 'BLK', 'TOV', 'PF', 'PTS'],\n dtype='object')\n"}],"execution_count":null},{"cell_type":"code","source":["lista=df.columns\n","lista1=df1.columns\n","list(set(lista1).intersection(lista))"],"metadata":{"id":"jhKZywpq7wjv","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"3b5ec47b89ac47f596bdfeb258322081","outputId":"3f7df0e1-1c39-4d8b-b807-45540fc6e20a","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":6,"user_tz":300,"timestamp":1646686092396},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":"['Player', 'X1', 'Tm']"},"metadata":{},"execution_count":90}],"execution_count":null},{"cell_type":"code","source":["pd.merge(df1,df, on =['Player'],how= 'inner')"],"metadata":{"id":"WsqMFdORxDJZ","colab":{"height":424,"base_uri":"https://localhost:8080/"},"cell_id":"faa2fcee3f194390805cbd51d19ad6a2","outputId":"6950d31d-e462-4ac8-cb73-9ff842e5ed13","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":10,"user_tz":300,"timestamp":1646686093670},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/html":"\n
\n
\n
\n\n
\n \n
\n
\n
X1_x
\n
Year
\n
Player
\n
Pos
\n
Age
\n
Tm_x
\n
G
\n
GS
\n
MP
\n
PER
\n
...
\n
TRB
\n
AST
\n
STL
\n
BLK
\n
TOV
\n
PF
\n
PTS
\n
X1_y
\n
Tm_y
\n
season17_18
\n
\n \n \n
\n
0
\n
24096.0
\n
2017.0
\n
Alex Abrines
\n
SG
\n
23.0
\n
OKC
\n
68.0
\n
NaN
\n
1055.0
\n
10.1
\n
...
\n
86.0
\n
40.0
\n
NaN
\n
NaN
\n
NaN
\n
114.0
\n
406.0
\n
185.0
\n
OKC
\n
5725000.0
\n
\n
\n
1
\n
24097.0
\n
2017.0
\n
Quincy Acy
\n
PF
\n
26.0
\n
TOT
\n
38.0
\n
1.0
\n
558.0
\n
11.8
\n
...
\n
115.0
\n
18.0
\n
NaN
\n
NaN
\n
NaN
\n
67.0
\n
222.0
\n
350.0
\n
BRK
\n
1709538.0
\n
\n
\n
2
\n
24098.0
\n
2017.0
\n
Quincy Acy
\n
PF
\n
26.0
\n
DAL
\n
6.0
\n
0.0
\n
48.0
\n
-1.4
\n
...
\n
8.0
\n
0.0
\n
0.0
\n
0.0
\n
NaN
\n
9.0
\n
13.0
\n
350.0
\n
BRK
\n
1709538.0
\n
\n
\n
3
\n
24099.0
\n
2017.0
\n
Quincy Acy
\n
PF
\n
26.0
\n
BRK
\n
32.0
\n
1.0
\n
510.0
\n
13.1
\n
...
\n
107.0
\n
18.0
\n
NaN
\n
NaN
\n
NaN
\n
58.0
\n
209.0
\n
350.0
\n
BRK
\n
1709538.0
\n
\n
\n
4
\n
24100.0
\n
2017.0
\n
Steven Adams
\n
C
\n
23.0
\n
OKC
\n
80.0
\n
NaN
\n
2389.0
\n
16.5
\n
...
\n
615.0
\n
86.0
\n
NaN
\n
NaN
\n
NaN
\n
195.0
\n
905.0
\n
32.0
\n
OKC
\n
22471910.0
\n
\n
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
...
\n
\n
\n
547
\n
24686.0
\n
2017.0
\n
Cody Zeller
\n
PF
\n
24.0
\n
CHO
\n
62.0
\n
NaN
\n
1725.0
\n
16.7
\n
...
\n
405.0
\n
99.0
\n
NaN
\n
NaN
\n
NaN
\n
189.0
\n
639.0
\n
95.0
\n
CHO
\n
12584270.0
\n
\n
\n
548
\n
24687.0
\n
2017.0
\n
Tyler Zeller
\n
C
\n
27.0
\n
BOS
\n
51.0
\n
NaN
\n
525.0
\n
13.0
\n
...
\n
124.0
\n
42.0
\n
NaN
\n
NaN
\n
NaN
\n
61.0
\n
178.0
\n
349.0
\n
MIL
\n
1709538.0
\n
\n
\n
549
\n
24688.0
\n
2017.0
\n
Stephen Zimmerman
\n
C
\n
20.0
\n
ORL
\n
19.0
\n
0.0
\n
108.0
\n
7.3
\n
...
\n
35.0
\n
4.0
\n
NaN
\n
NaN
\n
NaN
\n
17.0
\n
23.0
\n
443.0
\n
LAL
\n
1312611.0
\n
\n
\n
550
\n
24689.0
\n
2017.0
\n
Paul Zipser
\n
SF
\n
22.0
\n
CHI
\n
44.0
\n
NaN
\n
843.0
\n
6.9
\n
...
\n
125.0
\n
36.0
\n
NaN
\n
NaN
\n
NaN
\n
78.0
\n
240.0
\n
432.0
\n
CHI
\n
1312611.0
\n
\n
\n
551
\n
24690.0
\n
2017.0
\n
Ivica Zubac
\n
C
\n
19.0
\n
LAL
\n
38.0
\n
NaN
\n
609.0
\n
17.0
\n
...
\n
159.0
\n
30.0
\n
NaN
\n
NaN
\n
NaN
\n
66.0
\n
284.0
\n
426.0
\n
LAL
\n
1312611.0
\n
\n \n
\n
552 rows × 56 columns
\n
\n \n \n \n\n \n
\n
\n ","text/plain":" X1_x Year Player Pos Age Tm_x G GS MP \\\n0 24096.0 2017.0 Alex Abrines SG 23.0 OKC 68.0 NaN 1055.0 \n1 24097.0 2017.0 Quincy Acy PF 26.0 TOT 38.0 1.0 558.0 \n2 24098.0 2017.0 Quincy Acy PF 26.0 DAL 6.0 0.0 48.0 \n3 24099.0 2017.0 Quincy Acy PF 26.0 BRK 32.0 1.0 510.0 \n4 24100.0 2017.0 Steven Adams C 23.0 OKC 80.0 NaN 2389.0 \n.. ... ... ... .. ... ... ... ... ... \n547 24686.0 2017.0 Cody Zeller PF 24.0 CHO 62.0 NaN 1725.0 \n548 24687.0 2017.0 Tyler Zeller C 27.0 BOS 51.0 NaN 525.0 \n549 24688.0 2017.0 Stephen Zimmerman C 20.0 ORL 19.0 0.0 108.0 \n550 24689.0 2017.0 Paul Zipser SF 22.0 CHI 44.0 NaN 843.0 \n551 24690.0 2017.0 Ivica Zubac C 19.0 LAL 38.0 NaN 609.0 \n\n PER ... TRB AST STL BLK TOV PF PTS X1_y Tm_y \\\n0 10.1 ... 86.0 40.0 NaN NaN NaN 114.0 406.0 185.0 OKC \n1 11.8 ... 115.0 18.0 NaN NaN NaN 67.0 222.0 350.0 BRK \n2 -1.4 ... 8.0 0.0 0.0 0.0 NaN 9.0 13.0 350.0 BRK \n3 13.1 ... 107.0 18.0 NaN NaN NaN 58.0 209.0 350.0 BRK \n4 16.5 ... 615.0 86.0 NaN NaN NaN 195.0 905.0 32.0 OKC \n.. ... ... ... ... ... ... ... ... ... ... ... \n547 16.7 ... 405.0 99.0 NaN NaN NaN 189.0 639.0 95.0 CHO \n548 13.0 ... 124.0 42.0 NaN NaN NaN 61.0 178.0 349.0 MIL \n549 7.3 ... 35.0 4.0 NaN NaN NaN 17.0 23.0 443.0 LAL \n550 6.9 ... 125.0 36.0 NaN NaN NaN 78.0 240.0 432.0 CHI \n551 17.0 ... 159.0 30.0 NaN NaN NaN 66.0 284.0 426.0 LAL \n\n season17_18 \n0 5725000.0 \n1 1709538.0 \n2 1709538.0 \n3 1709538.0 \n4 22471910.0 \n.. ... \n547 12584270.0 \n548 1709538.0 \n549 1312611.0 \n550 1312611.0 \n551 1312611.0 \n\n[552 rows x 56 columns]"},"metadata":{},"execution_count":91}],"execution_count":null},{"cell_type":"code","source":["pd.merge(df1,df, on =['Player'],how= 'inner')[['Player','PTS','season17_18']]"],"metadata":{"id":"n9G32WVg9K5Y","colab":{"height":424,"base_uri":"https://localhost:8080/"},"cell_id":"821769bffbdf40a49d81abc5323e5049","outputId":"7bf51cd5-1f18-4df9-8054-2fcd24e8ce5b","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":11,"user_tz":300,"timestamp":1646686095197},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/html":"\n
\n
\n
\n\n
\n \n
\n
\n
Player
\n
PTS
\n
season17_18
\n
\n \n \n
\n
0
\n
Alex Abrines
\n
406.0
\n
5725000.0
\n
\n
\n
1
\n
Quincy Acy
\n
222.0
\n
1709538.0
\n
\n
\n
2
\n
Quincy Acy
\n
13.0
\n
1709538.0
\n
\n
\n
3
\n
Quincy Acy
\n
209.0
\n
1709538.0
\n
\n
\n
4
\n
Steven Adams
\n
905.0
\n
22471910.0
\n
\n
\n
...
\n
...
\n
...
\n
...
\n
\n
\n
547
\n
Cody Zeller
\n
639.0
\n
12584270.0
\n
\n
\n
548
\n
Tyler Zeller
\n
178.0
\n
1709538.0
\n
\n
\n
549
\n
Stephen Zimmerman
\n
23.0
\n
1312611.0
\n
\n
\n
550
\n
Paul Zipser
\n
240.0
\n
1312611.0
\n
\n
\n
551
\n
Ivica Zubac
\n
284.0
\n
1312611.0
\n
\n \n
\n
552 rows × 3 columns
\n
\n \n \n \n\n \n
\n
\n ","text/plain":" Player PTS season17_18\n0 Alex Abrines 406.0 5725000.0\n1 Quincy Acy 222.0 1709538.0\n2 Quincy Acy 13.0 1709538.0\n3 Quincy Acy 209.0 1709538.0\n4 Steven Adams 905.0 22471910.0\n.. ... ... ...\n547 Cody Zeller 639.0 12584270.0\n548 Tyler Zeller 178.0 1709538.0\n549 Stephen Zimmerman 23.0 1312611.0\n550 Paul Zipser 240.0 1312611.0\n551 Ivica Zubac 284.0 1312611.0\n\n[552 rows x 3 columns]"},"metadata":{},"execution_count":92}],"execution_count":null},{"cell_type":"code","source":["f = {'season17_18':['sum'], 'PTS':['mean']}\n","pd.merge(df1,df, on =['Player'],how= 'inner')[['Player','PTS','season17_18']].groupby('Player').agg(f)"],"metadata":{"id":"i2bhQxOn98nW","colab":{"height":487,"base_uri":"https://localhost:8080/"},"cell_id":"d7f2af338af247438cf390736ce74f54","outputId":"90707127-92f2-4163-af4f-c91cd8a45a96","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":11,"user_tz":300,"timestamp":1646686096550},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/html":"\n
\n
\n
\n\n
\n \n
\n
\n
season17_18
\n
PTS
\n
\n
\n
\n
sum
\n
mean
\n
\n
\n
Player
\n
\n
\n
\n \n \n
\n
A.J. Hammons
\n
1312611.0
\n
48.0
\n
\n
\n
Aaron Brooks
\n
2116955.0
\n
322.0
\n
\n
\n
Aaron Gordon
\n
5504420.0
\n
1019.0
\n
\n
\n
Al Horford
\n
27734405.0
\n
952.0
\n
\n
\n
Al Jefferson
\n
9769821.0
\n
535.0
\n
\n
\n
...
\n
...
\n
...
\n
\n
\n
Wilson Chandler
\n
12016854.0
\n
1117.0
\n
\n
\n
Yogi Ferrell
\n
3937833.0
\n
308.0
\n
\n
\n
Zach LaVine
\n
3202217.0
\n
889.0
\n
\n
\n
Zach Randolph
\n
12307692.0
\n
1028.0
\n
\n
\n
Zaza Pachulia
\n
3477600.0
\n
426.0
\n
\n \n
\n
411 rows × 2 columns
\n
\n \n \n \n\n \n
\n
\n ","text/plain":" season17_18 PTS\n sum mean\nPlayer \nA.J. Hammons 1312611.0 48.0\nAaron Brooks 2116955.0 322.0\nAaron Gordon 5504420.0 1019.0\nAl Horford 27734405.0 952.0\nAl Jefferson 9769821.0 535.0\n... ... ...\nWilson Chandler 12016854.0 1117.0\nYogi Ferrell 3937833.0 308.0\nZach LaVine 3202217.0 889.0\nZach Randolph 12307692.0 1028.0\nZaza Pachulia 3477600.0 426.0\n\n[411 rows x 2 columns]"},"metadata":{},"execution_count":93}],"execution_count":null},{"cell_type":"markdown","source":["\n"," \n","Created in Deepnote"],"metadata":{"created_in_deepnote_cell":true,"deepnote_cell_type":"markdown","id":"Gb4AoqVPlw5P"}}],"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[]},"deepnote":{},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"},"deepnote_notebook_id":"1336820dbdea4d368d35f8eb16bbfb0f","deepnote_execution_queue":[]}}