{"cells":[{"cell_type":"markdown","source":["# Parte 1"],"metadata":{"id":"l3NUdKOT5ZS-","cell_id":"34b852c215da455a9bb7a60c7ec5120d","deepnote_cell_type":"markdown"}},{"cell_type":"code","source":["import pandas as pd\n","import matplotlib.pyplot as plt\n","# Leer el dataset\n","url='https://raw.githubusercontent.com/JJTorresDS/ds-data-sources/main/income_per_person_gdppercapita_ppp_inflation_adjusted.csv'\n","df= pd.read_csv(url,sep=',')\n","df"],"metadata":{"id":"mVBn0TNV34Pv","colab":{"height":424,"base_uri":"https://localhost:8080/"},"cell_id":"3af518a0b6784588aadd3274c5f7f749","outputId":"519d1a75-044e-48f1-df87-adbcefc7a207","executionInfo":{"user":{"userId":"11864357500095360887","displayName":"Franco Giordano"},"status":"ok","elapsed":686,"user_tz":180,"timestamp":1690498972451},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":[" country 1799 1800 1801 1802 1803 1804 1805 1806 \\\n","0 Afghanistan 674 674 674 674 674 674 674 674 \n","1 Angola 691 693 697 700 702 705 709 712 \n","2 Albania 746 746 746 746 746 747 747 747 \n","3 Andorra 1340 1340 1340 1350 1350 1350 1350 1360 \n","4 United Arab Emirates 1120 1120 1120 1130 1130 1140 1140 1150 \n",".. ... ... ... ... ... ... ... ... ... \n","190 Samoa 1570 1570 1570 1570 1570 1570 1570 1570 \n","191 Yemen 981 983 986 988 992 994 997 1000 \n","192 South Africa 1760 1740 1720 1700 1680 1590 1590 1730 \n","193 Zambia 741 743 746 747 749 750 752 755 \n","194 Zimbabwe 972 973 974 975 976 977 978 979 \n","\n"," 1807 ... 2040 2041 2042 2043 2044 2045 2046 2047 2048 \\\n","0 674 ... 2880 2940 3000 3070 3130 3200 3270 3340 3410 \n","1 716 ... 8040 8220 8390 8570 8750 8940 9120 9320 9520 \n","2 747 ... 24.5k 25k 25.5k 26.1k 26.6k 27.2k 27.8k 28.3k 28.9k \n","3 1360 ... 108k 111k 113k 116k 118k 121k 123k 126k 128k \n","4 1150 ... 74.5k 76.1k 77.7k 79.3k 81k 82.7k 84.5k 86.3k 88.1k \n",".. ... ... ... ... ... ... ... ... ... ... ... \n","190 1570 ... 8230 8410 8590 8770 8960 9150 9340 9540 9740 \n","191 1000 ... 3980 4060 4150 4240 4330 4420 4510 4610 4710 \n","192 1510 ... 14.5k 14.8k 15.2k 15.5k 15.8k 16.1k 16.5k 16.8k 17.2k \n","193 756 ... 3530 3610 3680 3760 3840 3920 4010 4090 4180 \n","194 981 ... 3490 3570 3640 3720 3800 3880 3960 4050 4130 \n","\n"," 2049 \n","0 3480 \n","1 9720 \n","2 29.6k \n","3 131k \n","4 90k \n",".. ... \n","190 9950 \n","191 4810 \n","192 17.6k \n","193 4270 \n","194 4220 \n","\n","[195 rows x 252 columns]"],"text/html":["\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"," \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"," \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"," \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"," \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"," \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"," \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"," \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"," \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"," \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"," \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"," \n"," \n","
country179918001801180218031804180518061807...2040204120422043204420452046204720482049
0Afghanistan674674674674674674674674674...2880294030003070313032003270334034103480
1Angola691693697700702705709712716...8040822083908570875089409120932095209720
2Albania746746746746746747747747747...24.5k25k25.5k26.1k26.6k27.2k27.8k28.3k28.9k29.6k
3Andorra134013401340135013501350135013601360...108k111k113k116k118k121k123k126k128k131k
4United Arab Emirates112011201120113011301140114011501150...74.5k76.1k77.7k79.3k81k82.7k84.5k86.3k88.1k90k
..................................................................
190Samoa157015701570157015701570157015701570...8230841085908770896091509340954097409950
191Yemen98198398698899299499710001000...3980406041504240433044204510461047104810
192South Africa176017401720170016801590159017301510...14.5k14.8k15.2k15.5k15.8k16.1k16.5k16.8k17.2k17.6k
193Zambia741743746747749750752755756...3530361036803760384039204010409041804270
194Zimbabwe972973974975976977978979981...3490357036403720380038803960405041304220
\n","

195 rows × 252 columns

\n","
\n"," \n","\n","\n","\n","
\n"," \n","
\n","\n","\n","\n"," \n","\n"," \n"," \n","\n"," \n","
\n","
\n"]},"metadata":{},"execution_count":1}],"execution_count":1},{"cell_type":"markdown","source":["# verificacion de nulos"],"metadata":{"id":"SIVPW6LaIdNB","cell_id":"2cc90bcde632436996d39f0bfc50a7d3","deepnote_cell_type":"markdown"}},{"cell_type":"code","source":["sum(df.isnull().sum())"],"metadata":{"id":"BFIzgZ6EIemY","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"e3dcf04bac754c588ab5375cb924bd2f","outputId":"64a9095a-c08a-484e-e166-a863e7d64156","executionInfo":{"user":{"userId":"11864357500095360887","displayName":"Franco Giordano"},"status":"ok","elapsed":14,"user_tz":180,"timestamp":1690498972453},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/plain":["0"]},"metadata":{},"execution_count":2}],"execution_count":2},{"cell_type":"markdown","source":["# verificacion de duplicados"],"metadata":{"id":"xU0V-WbyIixT","cell_id":"f5e834b4be7a4fb98fe74db3e019d57b","deepnote_cell_type":"markdown"}},{"cell_type":"code","source":["print(df.shape)\n","df= df.drop_duplicates()\n","print(df.shape)"],"metadata":{"id":"AjBS9piZIkcG","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"da11cbfe3572414eb8d4de9f87c3049c","outputId":"9e37104d-168a-4017-e7c5-a7b2ab69becc","executionInfo":{"user":{"userId":"11864357500095360887","displayName":"Franco Giordano"},"status":"ok","elapsed":3,"user_tz":180,"timestamp":1690498974674},"deepnote_cell_type":"code"},"outputs":[{"output_type":"stream","name":"stdout","text":["(195, 252)\n","(195, 252)\n"]}],"execution_count":3},{"cell_type":"markdown","source":["# Comprension de la estructura de la data (inicial)"],"metadata":{"id":"KweJlYJwIs1v","cell_id":"9afca38ff901466b83b7404bf85eae59","deepnote_cell_type":"markdown"}},{"cell_type":"code","source":["# Parte 1\n","df_pais=df[df['country'] == 'Argentina'].iloc[:,217:224]\n","lista=df_pais.values[0]\n","lista"],"metadata":{"id":"eHrE6BP35dI8","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"cd03da1ab6644393abef02aff381039e","outputId":"32418d3e-3659-4165-aa00-4352851453cc","executionInfo":{"user":{"userId":"11864357500095360887","displayName":"Franco Giordano"},"status":"ok","elapsed":3,"user_tz":180,"timestamp":1690500247279},"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"," dtype=object)"]},"metadata":{},"execution_count":20}],"execution_count":20},{"cell_type":"code","source":["def promedio_pais(fila):\n"," suma = cantidad = 0\n"," for col in fila:\n"," if str(col)[-1] == \"k\":\n"," col = col[:-1]\n"," suma += float(col)\n"," cantidad += 1\n"," return suma/cantidad\n","\n","import numpy as np\n","df_pais=df_pais.apply(lambda x: x.replace(\"k\", \"\"))\n","df_pais"],"metadata":{"colab":{"base_uri":"https://localhost:8080/","height":81},"id":"DQriPzxdo7t-","executionInfo":{"status":"ok","timestamp":1690501500547,"user_tz":180,"elapsed":338,"user":{"displayName":"Franco Giordano","userId":"11864357500095360887"}},"outputId":"f27c2048-43e5-4ae8-c7c8-b07294250af9"},"execution_count":40,"outputs":[{"output_type":"execute_result","data":{"text/plain":[" 2015 2016 2017 2018 2019 2020 2021 promedio\n","5 23.2k 23.6k 22.8k 22.1k 19.7k 20.6k 20.9k NaN"],"text/html":["\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"," \n"," \n"," \n"," \n"," \n"," \n","
2015201620172018201920202021promedio
523.2k23.6k22.8k22.1k19.7k20.6k20.9kNaN
\n","
\n"," \n","\n","\n","\n","
\n"," \n","
\n","\n","\n","\n"," \n","\n"," \n"," \n","\n"," \n","
\n","
\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 \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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
X1PlayerTmseason17_18
01.0Stephen CurryGSW34682550.0
12.0LeBron JamesCLE33285709.0
23.0Paul MillsapDEN31269231.0
34.0Gordon HaywardBOS29727900.0
45.0Blake GriffinDET29512900.0
\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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
X1YearPlayerPosAgeTmGGSMPPER...FT%ORBDRBTRBASTSTLBLKTOVPFPTS
00.01950.0Curly ArmstrongG-F31.0FTW63.0NaNNaNNaN...0.705NaNNaNNaN176.0NaNNaNNaN217.0458.0
11.01950.0Cliff BarkerSG29.0INO49.0NaNNaNNaN...0.708NaNNaNNaN109.0NaNNaNNaN99.0279.0
22.01950.0Leo BarnhorstSF25.0CHS67.0NaNNaNNaN...0.698NaNNaNNaN140.0NaNNaNNaN192.0438.0
33.01950.0Ed BartelsF24.0TOT15.0NaNNaNNaN...0.559NaNNaNNaN20.0NaNNaNNaN29.063.0
44.01950.0Ed BartelsF24.0DNN13.0NaNNaNNaN...0.548NaNNaNNaN20.0NaNNaNNaN27.059.0
..................................................................
2468624686.02017.0Cody ZellerPF24.0CHO62.0NaN1725.016.7...0.679NaNNaN405.099.0NaNNaNNaN189.0639.0
2468724687.02017.0Tyler ZellerC27.0BOS51.0NaN525.013.0...0.564NaNNaN124.042.0NaNNaNNaN61.0178.0
2468824688.02017.0Stephen ZimmermanC20.0ORL19.00.0108.07.3...0.600NaNNaN35.04.0NaNNaNNaN17.023.0
2468924689.02017.0Paul ZipserSF22.0CHI44.0NaN843.06.9...0.775NaNNaN125.036.0NaNNaNNaN78.0240.0
2469024690.02017.0Ivica ZubacC19.0LAL38.0NaN609.017.0...0.653NaNNaN159.030.0NaNNaNNaN66.0284.0
\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
\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 \n \n \n \n \n
X1YearPlayerPosAgeTmGGSMPPER...FT%ORBDRBTRBASTSTLBLKTOVPFPTS
\n

0 rows × 53 columns

\n
\n \n \n \n\n \n
\n
\n ","text/plain":"Empty DataFrame\nColumns: [X1, Year, Player, Pos, Age, Tm, G, GS, MP, PER, TS%, 3PAr, FTr, ORB%, DRB%, TRB%, AST%, STL%, BLK%, TOV%, USG%, blanl, OWS, DWS, WS, WS/48, blank2, OBPM, DBPM, BPM, VORP, FG, FGA, FG%, 3P, 3PA, 3P%, 2P, 2PA, 2P%, eFG%, FT, FTA, FT%, ORB, DRB, TRB, AST, STL, BLK, TOV, PF, PTS]\nIndex: []\n\n[0 rows x 53 columns]"},"metadata":{},"execution_count":73}],"execution_count":null},{"cell_type":"code","source":["print(df1.shape)\n","df1_final=df1.dropna(axis=1)# Filas con columas con Nas seran removidas\n","print(df1_final.shape)\n","df1_final.head(10)\n","# ! Esto NO funciona!"],"metadata":{"id":"C5-6bNYbsolA","colab":{"height":398,"base_uri":"https://localhost:8080/"},"cell_id":"1def2d97a7d44e5ab743e8196d3005ad","outputId":"14047dd1-1344-4f4c-8f59-7285ee73d6c3","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":1646686062311},"deepnote_cell_type":"code"},"outputs":[{"output_type":"stream","name":"stdout","text":"(24691, 53)\n(24691, 1)\n"},{"output_type":"execute_result","data":{"text/html":"\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 \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
X1
00.0
11.0
22.0
33.0
44.0
55.0
66.0
77.0
88.0
99.0
\n
\n \n \n \n\n \n
\n
\n ","text/plain":" X1\n0 0.0\n1 1.0\n2 2.0\n3 3.0\n4 4.0\n5 5.0\n6 6.0\n7 7.0\n8 8.0\n9 9.0"},"metadata":{},"execution_count":74}],"execution_count":null},{"cell_type":"markdown","source":["**Que Columnas removeriamos**\n","\n"],"metadata":{"id":"z4Z8HFjhsxui","cell_id":"62fba8e161374e1189f430ebfd5f480e","deepnote_cell_type":"markdown"}},{"cell_type":"code","source":["percent_missing = df1.isnull().sum() * 100 / len(df1)\n","missing_value_df = pd.DataFrame({'Columnas': df1.columns,\n"," 'Porcentaje_Missing': percent_missing})\n","missing_value_df"],"metadata":{"id":"jOWuahefs_WX","colab":{"height":1000,"base_uri":"https://localhost:8080/"},"cell_id":"f7ab12eedef04685b8143e0adc117fe2","outputId":"d3d1856c-c0c9-494c-8745-f0964b5ca54a","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":392,"user_tz":300,"timestamp":1646686065525},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/html":"\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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \n \n \n \n \n \n \n \n \n \n
ColumnasPorcentaje_Missing
X1X10.000000
YearYear0.271354
PlayerPlayer0.271354
PosPos0.271354
AgeAge0.303754
TmTm0.271354
GG0.271354
GSGS74.699283
MPMP2.239682
PERPER2.389535
TS%TS%0.619659
3PAr3PAr86.019197
FTrFTr0.672310
ORB%ORB%96.043093
DRB%DRB%98.497428
TRB%TRB%98.967235
AST%AST%96.901705
STL%STL%91.822931
BLK%BLK%87.691872
TOV%TOV%98.177474
USG%USG%99.765097
blanlblanl100.000000
OWSOWS0.429306
DWSDWS0.429306
WSWS0.429306
WS/48WS/482.389535
blank2blank2100.000000
OBPMOBPM97.974971
DBPMDBPM97.100158
BPMBPM98.331376
VORPVORP87.497469
FGFG0.271354
FGAFGA0.271354
FG%FG%0.672310
3P3P64.885991
3PA3PA79.040946
3P%3P%84.617877
2P2P0.271354
2PA2PA0.271354
2P%2P%0.789761
eFG%eFG%0.672310
FTFT0.271354
FTAFTA0.271354
FT%FT%3.746304
ORBORB93.791260
DRBDRB97.023207
TRBTRB1.534972
ASTAST0.271354
STLSTL92.317039
BLKBLK85.051233
TOVTOV96.233445
PFPF0.271354
PTSPTS0.271354
\n
\n \n \n \n\n \n
\n
\n ","text/plain":" Columnas Porcentaje_Missing\nX1 X1 0.000000\nYear Year 0.271354\nPlayer Player 0.271354\nPos Pos 0.271354\nAge Age 0.303754\nTm Tm 0.271354\nG G 0.271354\nGS GS 74.699283\nMP MP 2.239682\nPER PER 2.389535\nTS% TS% 0.619659\n3PAr 3PAr 86.019197\nFTr FTr 0.672310\nORB% ORB% 96.043093\nDRB% DRB% 98.497428\nTRB% TRB% 98.967235\nAST% AST% 96.901705\nSTL% STL% 91.822931\nBLK% BLK% 87.691872\nTOV% TOV% 98.177474\nUSG% USG% 99.765097\nblanl blanl 100.000000\nOWS OWS 0.429306\nDWS DWS 0.429306\nWS WS 0.429306\nWS/48 WS/48 2.389535\nblank2 blank2 100.000000\nOBPM OBPM 97.974971\nDBPM DBPM 97.100158\nBPM BPM 98.331376\nVORP VORP 87.497469\nFG FG 0.271354\nFGA FGA 0.271354\nFG% FG% 0.672310\n3P 3P 64.885991\n3PA 3PA 79.040946\n3P% 3P% 84.617877\n2P 2P 0.271354\n2PA 2PA 0.271354\n2P% 2P% 0.789761\neFG% eFG% 0.672310\nFT FT 0.271354\nFTA FTA 0.271354\nFT% FT% 3.746304\nORB ORB 93.791260\nDRB DRB 97.023207\nTRB TRB 1.534972\nAST AST 0.271354\nSTL STL 92.317039\nBLK BLK 85.051233\nTOV TOV 96.233445\nPF PF 0.271354\nPTS PTS 0.271354"},"metadata":{},"execution_count":75}],"execution_count":null},{"cell_type":"code","source":["missing_value_df_f=missing_value_df[missing_value_df['Porcentaje_Missing']<=50]\n","missing_value_df_f"],"metadata":{"id":"RA9qmYgxtbHf","colab":{"height":959,"base_uri":"https://localhost:8080/"},"cell_id":"fc81f4df48b44987b7a16b94ebdb9430","outputId":"3cae6438-19d6-4ad9-944e-b873b2a0e86c","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":539,"user_tz":300,"timestamp":1646686068255},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/html":"\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 \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 \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 \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 \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 \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
ColumnasPorcentaje_Missing
X1X10.000000
YearYear0.271354
PlayerPlayer0.271354
PosPos0.271354
AgeAge0.303754
TmTm0.271354
GG0.271354
MPMP2.239682
PERPER2.389535
TS%TS%0.619659
FTrFTr0.672310
OWSOWS0.429306
DWSDWS0.429306
WSWS0.429306
WS/48WS/482.389535
FGFG0.271354
FGAFGA0.271354
FG%FG%0.672310
2P2P0.271354
2PA2PA0.271354
2P%2P%0.789761
eFG%eFG%0.672310
FTFT0.271354
FTAFTA0.271354
FT%FT%3.746304
TRBTRB1.534972
ASTAST0.271354
PFPF0.271354
PTSPTS0.271354
\n
\n \n \n \n\n \n
\n
\n ","text/plain":" Columnas Porcentaje_Missing\nX1 X1 0.000000\nYear Year 0.271354\nPlayer Player 0.271354\nPos Pos 0.271354\nAge Age 0.303754\nTm Tm 0.271354\nG G 0.271354\nMP MP 2.239682\nPER PER 2.389535\nTS% TS% 0.619659\nFTr FTr 0.672310\nOWS OWS 0.429306\nDWS DWS 0.429306\nWS WS 0.429306\nWS/48 WS/48 2.389535\nFG FG 0.271354\nFGA FGA 0.271354\nFG% FG% 0.672310\n2P 2P 0.271354\n2PA 2PA 0.271354\n2P% 2P% 0.789761\neFG% eFG% 0.672310\nFT FT 0.271354\nFTA FTA 0.271354\nFT% FT% 3.746304\nTRB TRB 1.534972\nAST AST 0.271354\nPF PF 0.271354\nPTS PTS 0.271354"},"metadata":{},"execution_count":76}],"execution_count":null},{"cell_type":"code","source":["lista_variables=list(missing_value_df_f.Columnas)\n","print(type(lista_variables))\n","print(len(lista_variables))\n","lista_variables"],"metadata":{"id":"WUqINwX2tomG","colab":{"base_uri":"https://localhost:8080/"},"cell_id":"a1f39f17eecd45588e152dd87e5be1bb","outputId":"b6b3d06f-36e4-4642-a2a5-2cb296d4b58f","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":468,"user_tz":300,"timestamp":1646686070466},"deepnote_cell_type":"code"},"outputs":[{"output_type":"stream","name":"stdout","text":"\n29\n"},{"output_type":"execute_result","data":{"text/plain":"['X1',\n 'Year',\n 'Player',\n 'Pos',\n 'Age',\n 'Tm',\n 'G',\n 'MP',\n 'PER',\n 'TS%',\n 'FTr',\n 'OWS',\n 'DWS',\n 'WS',\n 'WS/48',\n 'FG',\n 'FGA',\n 'FG%',\n '2P',\n '2PA',\n '2P%',\n 'eFG%',\n 'FT',\n 'FTA',\n 'FT%',\n 'TRB',\n 'AST',\n 'PF',\n 'PTS']"},"metadata":{},"execution_count":77}],"execution_count":null},{"cell_type":"code","source":["df1_x=df1.loc[:, df1.columns.isin(lista_variables)]\n","df1_x"],"metadata":{"id":"3RzXeGbUt6F6","colab":{"height":424,"base_uri":"https://localhost:8080/"},"cell_id":"575f25d7dfce4a069ea530f4acab8afd","outputId":"e2559265-1db5-4a55-cdf5-d129d9539ece","executionInfo":{"user":{"userId":"09471607480253994520","photoUrl":"https://lh3.googleusercontent.com/a-/AOh14GjvGjd5VpSUEHTxlxXRYAinh8eCspL5nxvcW9wD=s64","displayName":"David Francisco Bustos Usta"},"status":"ok","elapsed":437,"user_tz":300,"timestamp":1646686072935},"deepnote_cell_type":"code"},"outputs":[{"output_type":"execute_result","data":{"text/html":"\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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \n
X1YearPlayerPosAgeTmGMPPERTS%...2PA2P%eFG%FTFTAFT%TRBASTPFPTS
00.01950.0Curly ArmstrongG-F31.0FTW63.0NaNNaN0.368...516.00.2790.279170.0241.00.705NaN176.0217.0458.0
11.01950.0Cliff BarkerSG29.0INO49.0NaNNaN0.435...274.00.3720.37275.0106.00.708NaN109.099.0279.0
22.01950.0Leo BarnhorstSF25.0CHS67.0NaNNaN0.394...499.00.3490.34990.0129.00.698NaN140.0192.0438.0
33.01950.0Ed BartelsF24.0TOT15.0NaNNaN0.312...86.00.2560.25619.034.00.559NaN20.029.063.0
44.01950.0Ed BartelsF24.0DNN13.0NaNNaN0.308...82.00.2560.25617.031.00.548NaN20.027.059.0
..................................................................
2468624686.02017.0Cody ZellerPF24.0CHO62.01725.016.70.604...442.00.5720.571133.0196.00.679405.099.0189.0639.0
2468724687.02017.0Tyler ZellerC27.0BOS51.0525.013.00.508...157.00.4970.49422.039.00.564124.042.061.0178.0
2468824688.02017.0Stephen ZimmermanC20.0ORL19.0108.07.30.346...31.00.3230.3233.05.00.60035.04.017.023.0
2468924689.02017.0Paul ZipserSF22.0CHI44.0843.06.90.503...122.00.4510.47331.040.00.775125.036.078.0240.0
2469024690.02017.0Ivica ZubacC19.0LAL38.0609.017.00.547...235.00.5360.52932.049.00.653159.030.066.0284.0
\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":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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
X1YearPlayerPosAgeTmGMPPERTS%...2PA2P%eFG%FTFTAFT%TRBASTPFPTS
00.01950.0Curly ArmstrongG-F31.0FTW63.0NaNNaN0.368...516.00.2790.279170.0241.00.705NaN176.0217.0458.0
11.01950.0Cliff BarkerSG29.0INO49.0NaNNaN0.435...274.00.3720.37275.0106.00.708NaN109.099.0279.0
22.01950.0Leo BarnhorstSF25.0CHS67.0NaNNaN0.394...499.00.3490.34990.0129.00.698NaN140.0192.0438.0
33.01950.0Ed BartelsF24.0TOT15.0NaNNaN0.312...86.00.2560.25619.034.00.559NaN20.029.063.0
44.01950.0Ed BartelsF24.0DNN13.0NaNNaN0.308...82.00.2560.25617.031.00.548NaN20.027.059.0
..................................................................
2468624686.02017.0Cody ZellerPF24.0CHO62.01725.016.70.604...442.00.5720.571133.0196.00.679405.099.0189.0639.0
2468724687.02017.0Tyler ZellerC27.0BOS51.0525.013.00.508...157.00.4970.49422.039.00.564124.042.061.0178.0
2468824688.02017.0Stephen ZimmermanC20.0ORL19.0108.07.30.346...31.00.3230.3233.05.00.60035.04.017.023.0
2468924689.02017.0Paul ZipserSF22.0CHI44.0843.06.90.503...122.00.4510.47331.040.00.775125.036.078.0240.0
2469024690.02017.0Ivica ZubacC19.0LAL38.0609.017.00.547...235.00.5360.52932.049.00.653159.030.066.0284.0
\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 \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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
X1PlayerTmseason17_18
01.0Stephen CurryGSW34682550.0
12.0LeBron JamesCLE33285709.0
23.0Paul MillsapDEN31269231.0
34.0Gordon HaywardBOS29727900.0
45.0Blake GriffinDET29512900.0
\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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
X1YearPlayerPosAgeTmGGSMPPER...FT%ORBDRBTRBASTSTLBLKTOVPFPTS
2409624096.02017.0Alex AbrinesSG23.0OKC68.0NaN1055.010.1...0.898NaNNaN86.040.0NaNNaNNaN114.0406.0
2409724097.02017.0Quincy AcyPF26.0TOT38.01.0558.011.8...0.750NaNNaN115.018.0NaNNaNNaN67.0222.0
2409824098.02017.0Quincy AcyPF26.0DAL6.00.048.0-1.4...0.667NaNNaN8.00.00.00.0NaN9.013.0
2409924099.02017.0Quincy AcyPF26.0BRK32.01.0510.013.1...0.754NaNNaN107.018.0NaNNaNNaN58.0209.0
2410024100.02017.0Steven AdamsC23.0OKC80.0NaN2389.016.5...0.611NaNNaN615.086.0NaNNaNNaN195.0905.0
..................................................................
2468624686.02017.0Cody ZellerPF24.0CHO62.0NaN1725.016.7...0.679NaNNaN405.099.0NaNNaNNaN189.0639.0
2468724687.02017.0Tyler ZellerC27.0BOS51.0NaN525.013.0...0.564NaNNaN124.042.0NaNNaNNaN61.0178.0
2468824688.02017.0Stephen ZimmermanC20.0ORL19.00.0108.07.3...0.600NaNNaN35.04.0NaNNaNNaN17.023.0
2468924689.02017.0Paul ZipserSF22.0CHI44.0NaN843.06.9...0.775NaNNaN125.036.0NaNNaNNaN78.0240.0
2469024690.02017.0Ivica ZubacC19.0LAL38.0NaN609.017.0...0.653NaNNaN159.030.0NaNNaNNaN66.0284.0
\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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \n \n \n \n
X1PlayerTmseason17_18
331332.0Anthony TolliverSAC2000000.0
555556.0Antonius ClevelandDAL50000.0
377378.0Arron AfflaloSAC1500000.0
552553.0Briante WeberHOU50000.0
550551.0Briante WeberLAL50000.0
503504.0DeAndre LigginsNOP172238.0
566567.0DeAndre LigginsATL26773.0
528529.0Demetrius JacksonHOU74159.0
535536.0Demetrius JacksonHOU50000.0
556557.0Diamond StoneCHI50000.0
297298.0Dwyane WadeMIA2328652.0
487488.0Ersan IlyasovaPHI502328.0
529530.0Georgios PapagiannisPOR74159.0
201202.0Greg MonroeBOS5000000.0
501502.0Isaiah CanaanCHI200000.0
532533.0Isaiah CanaanHOU53465.0
216217.0Jamal CrawfordMIN4328000.0
305306.0Jameer NelsonDET2262871.0
526527.0Jarell EddieCHI83129.0
572573.0Jarell EddieCHI17224.0
481482.0Joe JohnsonHOU749905.0
571572.0Joel BolomboyMIL22248.0
311312.0Josh SmithNOP2183934.0
534535.0Kyle CollinsworthDAL50000.0
480481.0Marco BelinelliPHI776217.0
539540.0Naz Mitrou-LongUTA50000.0
559560.0Nigel HayesLAL46080.0
560561.0Nigel HayesTOR46080.0
568569.0Quinn CookNOP25000.0
260261.0Rajon RondoCHI3000000.0
497498.0Ramon SessionsWAS263124.0
505506.0Rashad VaughnORL166258.0
299300.0Richard JeffersonDEN2328652.0
477478.0Sean KilpatrickMIL789725.0
504505.0Sean KilpatrickLAC172238.0
506507.0Troy WilliamsNYK148318.0
533534.0Tyler CavanaughATL50000.0
500501.0Wade BaldwinPOR222476.0
\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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
X1YearPlayerPosAgeTmGGSMPPER...FT%ORBDRBTRBASTSTLBLKTOVPFPTS
2415524155.02017.0Andrew BogutC32.0DAL26.0NaN582.09.4...0.273NaNNaN218.049.0NaNNaNNaN84.079.0
2415624156.02017.0Andrew BogutC32.0CLE1.00.01.0-35.3...NaN0.00.00.00.00.00.00.02.00.0
2449224492.02017.0Andrew NicholsonPF27.0BRK10.00.0111.05.0...1.000NaNNaN27.03.0NaN0.0NaN18.030.0
2449124491.02017.0Andrew NicholsonPF27.0WAS28.00.0231.06.3...0.583NaNNaN34.07.0NaNNaNNaN37.070.0
2416724167.02017.0Anthony BrownSF24.0NOP9.00.0143.05.9...NaNNaNNaN26.06.0NaN1.0NaN13.034.0
..................................................................
2425024250.02017.0Tyreke EvansSF27.0NOP26.00.0474.015.8...0.776NaNNaN86.091.0NaNNaNNaN41.0248.0
2458124581.02017.0Wayne SeldenSG22.0MEM11.0NaN189.06.2...0.6671.0NaN11.012.0NaN1.0NaN12.055.0
2458024580.02017.0Wayne SeldenSG22.0NOP3.0NaN47.010.0...0.5000.0NaN5.01.0NaN0.0NaN6.016.0
2426124261.02017.0Yogi FerrellPG23.0DAL36.0NaN1046.014.1...0.877NaNNaN99.0155.0NaNNaNNaN79.0408.0
2426024260.02017.0Yogi FerrellPG23.0BRK10.00.0151.06.5...0.625NaNNaN12.017.0NaNNaNNaN11.054.0
\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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
X1_xYearPlayerPosAgeTm_xGGSMPPER...TRBASTSTLBLKTOVPFPTSX1_yTm_yseason17_18
024096.02017.0Alex AbrinesSG23.0OKC68.0NaN1055.010.1...86.040.0NaNNaNNaN114.0406.0185.0OKC5725000.0
124097.02017.0Quincy AcyPF26.0TOT38.01.0558.011.8...115.018.0NaNNaNNaN67.0222.0350.0BRK1709538.0
224098.02017.0Quincy AcyPF26.0DAL6.00.048.0-1.4...8.00.00.00.0NaN9.013.0350.0BRK1709538.0
324099.02017.0Quincy AcyPF26.0BRK32.01.0510.013.1...107.018.0NaNNaNNaN58.0209.0350.0BRK1709538.0
424100.02017.0Steven AdamsC23.0OKC80.0NaN2389.016.5...615.086.0NaNNaNNaN195.0905.032.0OKC22471910.0
..................................................................
54724686.02017.0Cody ZellerPF24.0CHO62.0NaN1725.016.7...405.099.0NaNNaNNaN189.0639.095.0CHO12584270.0
54824687.02017.0Tyler ZellerC27.0BOS51.0NaN525.013.0...124.042.0NaNNaNNaN61.0178.0349.0MIL1709538.0
54924688.02017.0Stephen ZimmermanC20.0ORL19.00.0108.07.3...35.04.0NaNNaNNaN17.023.0443.0LAL1312611.0
55024689.02017.0Paul ZipserSF22.0CHI44.0NaN843.06.9...125.036.0NaNNaNNaN78.0240.0432.0CHI1312611.0
55124690.02017.0Ivica ZubacC19.0LAL38.0NaN609.017.0...159.030.0NaNNaNNaN66.0284.0426.0LAL1312611.0
\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 \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 \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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
PlayerPTSseason17_18
0Alex Abrines406.05725000.0
1Quincy Acy222.01709538.0
2Quincy Acy13.01709538.0
3Quincy Acy209.01709538.0
4Steven Adams905.022471910.0
............
547Cody Zeller639.012584270.0
548Tyler Zeller178.01709538.0
549Stephen Zimmerman23.01312611.0
550Paul Zipser240.01312611.0
551Ivica Zubac284.01312611.0
\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 \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 \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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
season17_18PTS
summean
Player
A.J. Hammons1312611.048.0
Aaron Brooks2116955.0322.0
Aaron Gordon5504420.01019.0
Al Horford27734405.0952.0
Al Jefferson9769821.0535.0
.........
Wilson Chandler12016854.01117.0
Yogi Ferrell3937833.0308.0
Zach LaVine3202217.0889.0
Zach Randolph12307692.01028.0
Zaza Pachulia3477600.0426.0
\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","Created in deepnote.com \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":[]}}