{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.7.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":37644,"databundleVersionId":4235210,"sourceType":"competition"}],"dockerImageVersionId":30301,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# Analisis exploratorio","metadata":{}},{"cell_type":"code","source":"import pandas as pd\nimport warnings\nimport numpy as np\nwarnings.simplefilter(\"ignore\", UserWarning)\n\ndf_raw = pd.read_csv(\"/kaggle/input/big-data-derby-2022/nyra_2019_complete.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:18.948032Z","iopub.execute_input":"2023-01-23T15:28:18.948521Z","iopub.status.idle":"2023-01-23T15:28:25.380003Z","shell.execute_reply.started":"2023-01-23T15:28:18.948483Z","shell.execute_reply":"2023-01-23T15:28:25.378534Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_raw.columns = [\"track_id\",\"race_date\",\"race_number\",\"program_number\",\n            \"trakus_index\",\"latitude\",\"longitude\",\"distance_id\",\"course_type\",\n            \"track_condition\",\"run_up_distance\",\"race_type\",\"purse\",\"post_time\",\n            \"weight_carried\",\"jockey\",\"odds\",\"position_at_finish\"]\n","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:25.381379Z","iopub.execute_input":"2023-01-23T15:28:25.381939Z","iopub.status.idle":"2023-01-23T15:28:25.389159Z","shell.execute_reply.started":"2023-01-23T15:28:25.381913Z","shell.execute_reply":"2023-01-23T15:28:25.387815Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_raw.info()","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:25.391483Z","iopub.execute_input":"2023-01-23T15:28:25.391863Z","iopub.status.idle":"2023-01-23T15:28:25.421980Z","shell.execute_reply.started":"2023-01-23T15:28:25.391823Z","shell.execute_reply":"2023-01-23T15:28:25.421026Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Existen variables de tipo object, sabemos de antemano que debemos convertirlas a variables numericas ","metadata":{}},{"cell_type":"code","source":"df_raw.head(3)","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:25.423280Z","iopub.execute_input":"2023-01-23T15:28:25.423646Z","iopub.status.idle":"2023-01-23T15:28:25.453328Z","shell.execute_reply.started":"2023-01-23T15:28:25.423614Z","shell.execute_reply":"2023-01-23T15:28:25.452047Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_raw.shape","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:25.454429Z","iopub.execute_input":"2023-01-23T15:28:25.454737Z","iopub.status.idle":"2023-01-23T15:28:25.460219Z","shell.execute_reply.started":"2023-01-23T15:28:25.454713Z","shell.execute_reply":"2023-01-23T15:28:25.459500Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_raw.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:25.461261Z","iopub.execute_input":"2023-01-23T15:28:25.461516Z","iopub.status.idle":"2023-01-23T15:28:26.733206Z","shell.execute_reply.started":"2023-01-23T15:28:25.461492Z","shell.execute_reply":"2023-01-23T15:28:26.731633Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"El program_number es un identificador único de cada carrera registrada","metadata":{}},{"cell_type":"code","source":"#df_raw00 = df_raw.sample(50000)\n#df_raw00.reset_index(inplace=True,drop=True)","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:26.734823Z","iopub.execute_input":"2023-01-23T15:28:26.735185Z","iopub.status.idle":"2023-01-23T15:28:26.740060Z","shell.execute_reply.started":"2023-01-23T15:28:26.735156Z","shell.execute_reply":"2023-01-23T15:28:26.739090Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"prog_num = df_raw[\"program_number\"].unique()\nprog_num","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:26.741214Z","iopub.execute_input":"2023-01-23T15:28:26.741482Z","iopub.status.idle":"2023-01-23T15:28:26.879695Z","shell.execute_reply.started":"2023-01-23T15:28:26.741458Z","shell.execute_reply":"2023-01-23T15:28:26.878579Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Se puede apreciar que esta variable contiene blancos, por tanto, los convertimos a una escala numérica, considerando que posteriormente debemos volver a la escala original de los datos para sus futuras interpretaciones.","metadata":{}},{"cell_type":"code","source":"def clean_program_number(x):\n    #Funcion que formatea la variable program_number\n    #La variable puede ser enumerada del 1 al 20.\n    try:\n        if(isinstance(x,str)): \n            x_temp=str(x.strip())\n            if(x_temp==\"1A\"):\n                x_temp = 17\n            if(x_temp==\"1X\"):\n                x_temp = 18\n            if(x_temp==\"3X\"):\n                x_temp = 19\n            if(x_temp==\"2B\"):\n                x_temp = 20\n            return int(x_temp)\n        else:\n            \n            return int(str(x).strip())\n    except:\n        pass","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:26.883742Z","iopub.execute_input":"2023-01-23T15:28:26.884136Z","iopub.status.idle":"2023-01-23T15:28:26.892092Z","shell.execute_reply.started":"2023-01-23T15:28:26.884110Z","shell.execute_reply":"2023-01-23T15:28:26.891127Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_raw[\"program_number\"] = df_raw[\"program_number\"].apply(lambda x: clean_program_number(x))","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:26.894818Z","iopub.execute_input":"2023-01-23T15:28:26.895054Z","iopub.status.idle":"2023-01-23T15:28:31.503271Z","shell.execute_reply.started":"2023-01-23T15:28:26.895032Z","shell.execute_reply":"2023-01-23T15:28:31.501962Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_raw.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:31.505515Z","iopub.execute_input":"2023-01-23T15:28:31.506015Z","iopub.status.idle":"2023-01-23T15:28:32.604382Z","shell.execute_reply.started":"2023-01-23T15:28:31.505977Z","shell.execute_reply":"2023-01-23T15:28:32.602644Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#NSET es una lista que tiene las variables que no consideramos para este analisis.\nNSET = ['race_number','race_date','latitude','longitude','jockey'] \nFEATURES = [feat for feat in df_raw.columns if feat  not in NSET ]\nFEATURES","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:32.606004Z","iopub.execute_input":"2023-01-23T15:28:32.606508Z","iopub.status.idle":"2023-01-23T15:28:32.613712Z","shell.execute_reply.started":"2023-01-23T15:28:32.606471Z","shell.execute_reply":"2023-01-23T15:28:32.612946Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#solo columnas que necesito \ndf_clean  = df_raw[FEATURES]\ndf_clean.head()","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:32.614455Z","iopub.execute_input":"2023-01-23T15:28:32.614741Z","iopub.status.idle":"2023-01-23T15:28:33.051151Z","shell.execute_reply.started":"2023-01-23T15:28:32.614716Z","shell.execute_reply":"2023-01-23T15:28:33.049748Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_clean.info()","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:33.052783Z","iopub.execute_input":"2023-01-23T15:28:33.053206Z","iopub.status.idle":"2023-01-23T15:28:33.066041Z","shell.execute_reply.started":"2023-01-23T15:28:33.053169Z","shell.execute_reply":"2023-01-23T15:28:33.064551Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Descubrimos los tipos de datos categoricos","metadata":{}},{"cell_type":"code","source":"list_categories = []\nlist_columns = df_clean.columns\nfor i, value in enumerate(df_clean.sample(1).iterrows()):\n        for j,dato in enumerate(value[1]):\n            print(i,j,type(dato),dato)\n            if(isinstance(dato,str)):\n                list_categories.append(list_columns[j])\n                \nlist_categories","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:33.067484Z","iopub.execute_input":"2023-01-23T15:28:33.067784Z","iopub.status.idle":"2023-01-23T15:28:33.391582Z","shell.execute_reply.started":"2023-01-23T15:28:33.067758Z","shell.execute_reply":"2023-01-23T15:28:33.390643Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_clean.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:33.392617Z","iopub.execute_input":"2023-01-23T15:28:33.392954Z","iopub.status.idle":"2023-01-23T15:28:34.128941Z","shell.execute_reply.started":"2023-01-23T15:28:33.392922Z","shell.execute_reply":"2023-01-23T15:28:34.127812Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_clean.shape","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:34.130294Z","iopub.execute_input":"2023-01-23T15:28:34.130673Z","iopub.status.idle":"2023-01-23T15:28:34.138134Z","shell.execute_reply.started":"2023-01-23T15:28:34.130644Z","shell.execute_reply":"2023-01-23T15:28:34.136920Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Verificamos la cantidad de datos unicos de cada columna categorica, ","metadata":{}},{"cell_type":"code","source":"#Funcion que convierte un dato de tipo string a numerico \n#considerando el total de datos para que se genere una secuencia lineal\n#de mapeo para las variables categoricas.\ndef convStrtoNum(x,df, colname=\"track_id\"):\n    #total de categorias que existen en una columna\n    id_list = df[colname].unique()\n    #Formateamos las categorias para no tener problemas\n    id_list = [str(id_list[i]).upper().strip() for i in range(len(id_list))]\n    #Defino una lista enumerada desde 1 a total de categorias de la columnas\n    list_enumerate = np.array([i+1 for i in range(len(id_list))],dtype=np.dtype(np.float32))\n    L=True\n    index_count = 0\n    #Mientras sea verdadero, define una entrada con formateo de texto forzado\n    #detectamos el dato recibido por parametro y lo enumeramos segun la categoria\n    #de la columna\n    #\n    while L:\n        X=(str(x).upper()).strip()\n        try:\n            if(X==id_list[index_count]):\n                L=False\n                return list_enumerate[index_count]\n        except:\n            L=False\n            return -1\n        index_count+=1","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:34.139579Z","iopub.execute_input":"2023-01-23T15:28:34.139910Z","iopub.status.idle":"2023-01-23T15:28:34.151816Z","shell.execute_reply.started":"2023-01-23T15:28:34.139883Z","shell.execute_reply":"2023-01-23T15:28:34.150021Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Funcion que ejecuta la conversion de str a numeric\ndef executeConvert(x,df):\n    return df[x].apply(lambda dataAtom: convStrtoNum(dataAtom,df,x))\n    ","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:34.154964Z","iopub.execute_input":"2023-01-23T15:28:34.155315Z","iopub.status.idle":"2023-01-23T15:28:34.164788Z","shell.execute_reply.started":"2023-01-23T15:28:34.155286Z","shell.execute_reply":"2023-01-23T15:28:34.163639Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_clean = df_clean.sample(10000)","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:37.398842Z","iopub.execute_input":"2023-01-23T15:28:37.399291Z","iopub.status.idle":"2023-01-23T15:28:37.703805Z","shell.execute_reply.started":"2023-01-23T15:28:37.399257Z","shell.execute_reply":"2023-01-23T15:28:37.701977Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_clean.reset_index(inplace=True, drop=True)","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:38.995866Z","iopub.execute_input":"2023-01-23T15:28:38.996515Z","iopub.status.idle":"2023-01-23T15:28:39.001972Z","shell.execute_reply.started":"2023-01-23T15:28:38.996485Z","shell.execute_reply":"2023-01-23T15:28:39.000850Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from multiprocessing import Pool\nfrom functools import partial\np = Pool(4)\n","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:39.807717Z","iopub.execute_input":"2023-01-23T15:28:39.808151Z","iopub.status.idle":"2023-01-23T15:28:39.870544Z","shell.execute_reply.started":"2023-01-23T15:28:39.808119Z","shell.execute_reply":"2023-01-23T15:28:39.868957Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Si creamos a nivel de objeto el rendimiento es mayor.","metadata":{}},{"cell_type":"code","source":"%%time\nlist_str_num = list(p.map(partial(executeConvert, df=df_clean),list_categories))\n#print(len(list_str_num[0]))","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:43.510183Z","iopub.execute_input":"2023-01-23T15:28:43.510695Z","iopub.status.idle":"2023-01-23T15:28:52.167878Z","shell.execute_reply.started":"2023-01-23T15:28:43.510642Z","shell.execute_reply":"2023-01-23T15:28:52.167074Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#pd.DataFrame(list_str_num[0]), df_clean[list_categories[0]]","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:52.169558Z","iopub.execute_input":"2023-01-23T15:28:52.169887Z","iopub.status.idle":"2023-01-23T15:28:52.174366Z","shell.execute_reply.started":"2023-01-23T15:28:52.169861Z","shell.execute_reply":"2023-01-23T15:28:52.173496Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for i,category in enumerate(list_categories):\n    df_clean[f\"{category}_01\"] = pd.DataFrame(list_str_num[i])\n    df_clean.drop(category,axis=1,inplace=True)","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:28:52.175551Z","iopub.execute_input":"2023-01-23T15:28:52.175828Z","iopub.status.idle":"2023-01-23T15:28:52.200647Z","shell.execute_reply.started":"2023-01-23T15:28:52.175806Z","shell.execute_reply":"2023-01-23T15:28:52.199450Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_clean.describe()","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:29:01.110411Z","iopub.execute_input":"2023-01-23T15:29:01.110804Z","iopub.status.idle":"2023-01-23T15:29:01.172624Z","shell.execute_reply.started":"2023-01-23T15:29:01.110773Z","shell.execute_reply":"2023-01-23T15:29:01.171356Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Ingeniería de caracteristicas\n\nLa variable **trakus_index** indica la cantidad de muestras totales que se tiene al finalizar la carrera y se recopilan cada 0.25 segundos. Se infiere lo siguiente:\n\n- En el dataset 'nyra_2019_complete.csv' el valor de trakus_index nos permite encontrar el tiempo total aproximado que tardo un jinete en llegar a la meta.\n- Si multiplicamos por 0.25 la columna trakus_index, tenemos el tiempo total que demoró un jinete.\n- Con el tiempo total  y la distancia total podemos obtener la potencia total media cuando el jinete cruza la meta. Tambien si generamos una media mu con desviacion estandar std que simule el peso de los equinos y jinetes, así la fórmula que desarrollaré tenga sentido.\n- Cuando arranca la partida las posiciones iniciales de los jinetes en donde salen los equinos influye en los primeros tramos por tanto los pesos asociados a esa serie temporal debe estudiarse de otra forma.\n- ","metadata":{}},{"cell_type":"markdown","source":"consideramos estas features para el análisis. Luego de la manipulacion de los datos, se aplica ingeniería de caracteísticas, en búsqueda de nuevas features que aporten valor a nuestro conjunto de datos.","metadata":{}},{"cell_type":"code","source":"def generateTimeAvg(total_track_id):\n    delta_t = 0.25\n    return total_track_id*delta_t\n","metadata":{"execution":{"iopub.status.busy":"2023-01-23T04:45:06.145690Z","iopub.execute_input":"2023-01-23T04:45:06.146220Z","iopub.status.idle":"2023-01-23T04:45:06.153284Z","shell.execute_reply.started":"2023-01-23T04:45:06.146185Z","shell.execute_reply":"2023-01-23T04:45:06.151603Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_clean[\"total_time\"] = df_clean[\"trakus_index\"].apply(lambda x: generateTimeAvg(x))\ntime = df_clean[\"total_time\"].to_numpy()\ndistance = df_clean[\"distance_id\"].to_numpy()\nvelocity = distance/time\ndf_clean[\"avg_speed\"] = velocity","metadata":{"execution":{"iopub.status.busy":"2023-01-23T04:45:14.500704Z","iopub.execute_input":"2023-01-23T04:45:14.501777Z","iopub.status.idle":"2023-01-23T04:45:14.517218Z","shell.execute_reply.started":"2023-01-23T04:45:14.501715Z","shell.execute_reply":"2023-01-23T04:45:14.516230Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_clean[\"weight_horse_aprox\"] = np.random.normal(loc=465.5,scale=56.5,size=len(df_clean))","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:34:34.510319Z","iopub.execute_input":"2023-01-23T15:34:34.510776Z","iopub.status.idle":"2023-01-23T15:34:34.518085Z","shell.execute_reply.started":"2023-01-23T15:34:34.510741Z","shell.execute_reply":"2023-01-23T15:34:34.516656Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_clean[\"Total_weight\"] = df_clean[\"weight_horse_aprox\"] + df_clean[\"weight_carried\"]","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:35:18.648845Z","iopub.execute_input":"2023-01-23T15:35:18.649272Z","iopub.status.idle":"2023-01-23T15:35:18.656281Z","shell.execute_reply.started":"2023-01-23T15:35:18.649239Z","shell.execute_reply":"2023-01-23T15:35:18.654650Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Considerando las leyes de la física, podemos expresar la velocidad final cuando se llega a la meta:\n\n$$\nSpeedAvg_{final}^{2}=SpeedAvg_{initial}^{2}+2*accelerationAvg*Totaldistance \\\\\naccelerationAvg = \\frac{SpeedAvg_{final}^{2}-SpeedAvg_{initial}^{2}}{2*Totaldistance}\n$$\nTodos los Jinetes en el estado inicial de la carrera comienzan con velocidad cero, de contrario seria trampa.\nSimplificando\n$$\naccelerationAvg = \\frac{SpeedAvg_{final}^{2}}{2*Totaldistance}\n$$\n$$\n\\frac{Force}{Mass} = \\frac{SpeedAvg_{final}^{2}}{2*Totaldistance}\n$$\n$$\nForce*Totaldistance= \\frac{Mass*SpeedAvg_{final}^{2}}{2}\n$$\n","metadata":{}},{"cell_type":"markdown","source":"$Force*Totaldistance$ si lo dividimos por el tiempo $[sec]$ transcurrido se obtiene la potencia $[\\frac{Joule}{sec}]$ con la que llega el jinete y su caballo a la meta.","metadata":{}},{"cell_type":"markdown","source":"Por tanto, los ganadores llegaran con mayor potencia al tener menor tiempo transcurrido durante la carrera. Influye la masa del jinete y el caballo para que llegue con la mayor potencia a la meta.","metadata":{}},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"markdown","source":"Se define la potencia como:\n\n$$\nPower = \\frac{Force*distance}{time}\n$$\n\nEn nuestro equivalente:\n$$\nW_{work}*\\frac{1}{TotalTime} = \\frac{Mass*SpeedAvg_{final}^{2}}{2}*\\frac{1}{TotalTime}\n$$\n\n\n$$\nPower_{final} = KineticEnergy*\\frac{1}{TotalTime}\n$$\n$$\nPower_{final} = \\frac{KineticEnergy}{TotalTime}\n$$\n","metadata":{}},{"cell_type":"code","source":"df_clean","metadata":{"execution":{"iopub.status.busy":"2023-01-23T04:45:22.452258Z","iopub.execute_input":"2023-01-23T04:45:22.453221Z","iopub.status.idle":"2023-01-23T04:45:22.482959Z","shell.execute_reply.started":"2023-01-23T04:45:22.453183Z","shell.execute_reply":"2023-01-23T04:45:22.481856Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_clean.describe()","metadata":{"execution":{"iopub.status.busy":"2023-01-23T15:27:54.837626Z","iopub.execute_input":"2023-01-23T15:27:54.838424Z","iopub.status.idle":"2023-01-23T15:27:54.918652Z","shell.execute_reply.started":"2023-01-23T15:27:54.838037Z","shell.execute_reply":"2023-01-23T15:27:54.917055Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"code","source":"from sklearn.preprocessing import MinMaxScaler\n","metadata":{"execution":{"iopub.status.busy":"2023-01-23T04:45:28.346550Z","iopub.execute_input":"2023-01-23T04:45:28.347007Z","iopub.status.idle":"2023-01-23T04:45:28.982974Z","shell.execute_reply.started":"2023-01-23T04:45:28.346953Z","shell.execute_reply":"2023-01-23T04:45:28.981790Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"scaler=MinMaxScaler()","metadata":{"execution":{"iopub.status.busy":"2023-01-23T04:45:30.092149Z","iopub.execute_input":"2023-01-23T04:45:30.092538Z","iopub.status.idle":"2023-01-23T04:45:30.097603Z","shell.execute_reply.started":"2023-01-23T04:45:30.092508Z","shell.execute_reply":"2023-01-23T04:45:30.096492Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_scaled = scaler.fit_transform(df_clean)\n","metadata":{"execution":{"iopub.status.busy":"2023-01-23T04:45:47.541929Z","iopub.execute_input":"2023-01-23T04:45:47.542300Z","iopub.status.idle":"2023-01-23T04:45:47.656492Z","shell.execute_reply.started":"2023-01-23T04:45:47.542266Z","shell.execute_reply":"2023-01-23T04:45:47.654723Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}