{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":82253,"databundleVersionId":8965849,"sourceType":"competition"}],"dockerImageVersionId":30733,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\n # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-06-29T02:58:11.029799Z","iopub.execute_input":"2024-06-29T02:58:11.030219Z","iopub.status.idle":"2024-06-29T02:58:11.047834Z","shell.execute_reply.started":"2024-06-29T02:58:11.030150Z","shell.execute_reply":"2024-06-29T02:58:11.046700Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\nfrom sklearn.preprocessing import OrdinalEncoder,OneHotEncoder,LabelEncoder\nfrom sklearn.impute import SimpleImputer, KNNImputer\nfrom sklearn.svm import SVC\nfrom sklearn.linear_model import LogisticRegression","metadata":{"execution":{"iopub.status.busy":"2024-06-29T02:58:11.053794Z","iopub.execute_input":"2024-06-29T02:58:11.054092Z","iopub.status.idle":"2024-06-29T02:58:12.328710Z","shell.execute_reply.started":"2024-06-29T02:58:11.054065Z","shell.execute_reply":"2024-06-29T02:58:12.327666Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### 1. Importing Dataset","metadata":{}},{"cell_type":"code","source":"df = pd.read_csv('/kaggle/input/f1nalyze-datathon-ieeecsmuj/train.csv',encoding=\"utf-8\")\nvalid_df = pd.read_csv(\"/kaggle/input/f1nalyze-datathon-ieeecsmuj/validation.csv\",encoding=\"utf-8\")\ntest_df = pd.read_csv(\"/kaggle/input/f1nalyze-datathon-ieeecsmuj/test.csv\",encoding=\"utf-8\")\n","metadata":{"execution":{"iopub.status.busy":"2024-06-29T02:58:12.330227Z","iopub.execute_input":"2024-06-29T02:58:12.330874Z","iopub.status.idle":"2024-06-29T02:58:48.335020Z","shell.execute_reply.started":"2024-06-29T02:58:12.330830Z","shell.execute_reply":"2024-06-29T02:58:48.333752Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.set_option('display.max_columns', None)","metadata":{"execution":{"iopub.status.busy":"2024-06-29T02:58:48.339669Z","iopub.execute_input":"2024-06-29T02:58:48.340155Z","iopub.status.idle":"2024-06-29T02:58:48.346074Z","shell.execute_reply.started":"2024-06-29T02:58:48.340111Z","shell.execute_reply":"2024-06-29T02:58:48.344714Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T02:58:48.347717Z","iopub.execute_input":"2024-06-29T02:58:48.348205Z","iopub.status.idle":"2024-06-29T02:58:48.406519Z","shell.execute_reply.started":"2024-06-29T02:58:48.348143Z","shell.execute_reply":"2024-06-29T02:58:48.405408Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"valid_df.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T02:58:48.407757Z","iopub.execute_input":"2024-06-29T02:58:48.408082Z","iopub.status.idle":"2024-06-29T02:58:48.454538Z","shell.execute_reply.started":"2024-06-29T02:58:48.408053Z","shell.execute_reply":"2024-06-29T02:58:48.453207Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.shape","metadata":{"execution":{"iopub.status.busy":"2024-06-29T02:58:48.455788Z","iopub.execute_input":"2024-06-29T02:58:48.456103Z","iopub.status.idle":"2024-06-29T02:58:48.464893Z","shell.execute_reply.started":"2024-06-29T02:58:48.456076Z","shell.execute_reply":"2024-06-29T02:58:48.463752Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.info()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:36:28.692609Z","iopub.execute_input":"2024-06-29T05:36:28.693092Z","iopub.status.idle":"2024-06-29T05:36:28.710394Z","shell.execute_reply.started":"2024-06-29T05:36:28.693055Z","shell.execute_reply":"2024-06-29T05:36:28.709109Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"## Checking For null values\ndf.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:36:28.962230Z","iopub.execute_input":"2024-06-29T05:36:28.963297Z","iopub.status.idle":"2024-06-29T05:36:41.320807Z","shell.execute_reply.started":"2024-06-29T05:36:28.963239Z","shell.execute_reply":"2024-06-29T05:36:41.319642Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.columns","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:36:41.322949Z","iopub.execute_input":"2024-06-29T05:36:41.323337Z","iopub.status.idle":"2024-06-29T05:36:41.332395Z","shell.execute_reply.started":"2024-06-29T05:36:41.323305Z","shell.execute_reply":"2024-06-29T05:36:41.330885Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"imp_cols = ['resultId', 'racerId', 'driverId', 'constructorId', 'grid',\n        'positionOrder', 'points', 'laps',\n        'timetaken_in_millisec',\n       'fastestLapTime', 'max_speed','round', 'circuitId',\n       'grand_prix', 'date','forename', 'surname','nationality',\n       'driverStandingsId','points_y','position',\n        'wins','company', 'nationality_y',\n        'status','result_driver_standing']","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:26.967213Z","iopub.execute_input":"2024-06-29T05:55:26.967666Z","iopub.status.idle":"2024-06-29T05:55:26.974457Z","shell.execute_reply.started":"2024-06-29T05:55:26.967626Z","shell.execute_reply":"2024-06-29T05:55:26.973140Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_valid_df = valid_df[imp_cols]\ntrain_df = df[imp_cols]","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:27.182216Z","iopub.execute_input":"2024-06-29T05:55:27.182678Z","iopub.status.idle":"2024-06-29T05:55:27.825398Z","shell.execute_reply.started":"2024-06-29T05:55:27.182628Z","shell.execute_reply":"2024-06-29T05:55:27.824119Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:27.828370Z","iopub.execute_input":"2024-06-29T05:55:27.828835Z","iopub.status.idle":"2024-06-29T05:55:27.858802Z","shell.execute_reply.started":"2024-06-29T05:55:27.828793Z","shell.execute_reply":"2024-06-29T05:55:27.857639Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"result_test_df = test_df[['resultId', 'racerId', 'driverId', 'constructorId', 'grid',\n        'positionOrder', 'points', 'laps',\n        'timetaken_in_millisec',\n       'fastestLapTime', 'max_speed','round', 'circuitId',\n       'grand_prix', 'date','forename', 'surname','nationality',\n       'driverStandingsId','points_y',\n        'wins','company', 'nationality_y',\n        'status','result_driver_standing']]","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:27.860896Z","iopub.execute_input":"2024-06-29T05:55:27.861326Z","iopub.status.idle":"2024-06-29T05:55:27.943518Z","shell.execute_reply.started":"2024-06-29T05:55:27.861290Z","shell.execute_reply":"2024-06-29T05:55:27.942285Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# train_valid_df = valid_df[['resultId', 'racerId', 'driverId', 'constructorId', 'grid',\n#         'positionOrder', 'points', 'laps',\n#         'timetaken_in_millisec',\n#        'fastestLapTime', 'max_speed','round', 'circuitId',\n#        'grand_prix', 'date','forename', 'surname','nationality',\n#        'driverStandingsId','points_y', 'position',\n#         'wins','company', 'nationality_y',\n#         'status','result_driver_standing']]","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:27.945705Z","iopub.execute_input":"2024-06-29T05:55:27.946063Z","iopub.status.idle":"2024-06-29T05:55:27.951225Z","shell.execute_reply.started":"2024-06-29T05:55:27.946032Z","shell.execute_reply":"2024-06-29T05:55:27.950075Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# train_df = df[['resultId', 'racerId', 'driverId', 'constructorId', 'grid',\n#         'positionOrder', 'points', 'laps',\n#         'timetaken_in_millisec',\n#        'fastestLapTime', 'max_speed','round', 'circuitId',\n#        'grand_prix', 'date','forename', 'surname','nationality',\n#        'driverStandingsId','points_y', 'position',\n#         'wins','company', 'nationality_y',\n#         'status','result_driver_standing']]","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:28.317405Z","iopub.execute_input":"2024-06-29T05:55:28.317856Z","iopub.status.idle":"2024-06-29T05:55:28.323322Z","shell.execute_reply.started":"2024-06-29T05:55:28.317819Z","shell.execute_reply":"2024-06-29T05:55:28.322101Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_valid_df.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:28.797867Z","iopub.execute_input":"2024-06-29T05:55:28.798294Z","iopub.status.idle":"2024-06-29T05:55:28.826823Z","shell.execute_reply.started":"2024-06-29T05:55:28.798263Z","shell.execute_reply":"2024-06-29T05:55:28.825652Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"## spliting lables and features\nX_train = train_df.drop('position',axis=1)\ny_train = train_df['position']\n\n\nX_valid_train = train_valid_df.drop('position',axis=1)\ny_valid_train = train_valid_df['position']","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:29.182323Z","iopub.execute_input":"2024-06-29T05:55:29.183288Z","iopub.status.idle":"2024-06-29T05:55:29.770222Z","shell.execute_reply.started":"2024-06-29T05:55:29.183248Z","shell.execute_reply":"2024-06-29T05:55:29.769227Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:29.987148Z","iopub.execute_input":"2024-06-29T05:55:29.988240Z","iopub.status.idle":"2024-06-29T05:55:30.013507Z","shell.execute_reply.started":"2024-06-29T05:55:29.988196Z","shell.execute_reply":"2024-06-29T05:55:30.012253Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train = X_train.replace(\"\\\\N\", np.nan)\n\n\nX_valid_train = X_valid_train.replace(\"\\\\N\", np.nan)\n\nresult_test_df = result_test_df.replace(\"\\\\N\",np.nan)\n\nX_train.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:30.577345Z","iopub.execute_input":"2024-06-29T05:55:30.577809Z","iopub.status.idle":"2024-06-29T05:55:38.090128Z","shell.execute_reply.started":"2024-06-29T05:55:30.577774Z","shell.execute_reply":"2024-06-29T05:55:38.088987Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"result_test_df.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:38.092896Z","iopub.execute_input":"2024-06-29T05:55:38.093387Z","iopub.status.idle":"2024-06-29T05:55:38.129774Z","shell.execute_reply.started":"2024-06-29T05:55:38.093340Z","shell.execute_reply":"2024-06-29T05:55:38.128381Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### 2. Data Cleaning","metadata":{}},{"cell_type":"code","source":"X_train.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:38.131293Z","iopub.execute_input":"2024-06-29T05:55:38.131732Z","iopub.status.idle":"2024-06-29T05:55:38.166136Z","shell.execute_reply.started":"2024-06-29T05:55:38.131681Z","shell.execute_reply":"2024-06-29T05:55:38.164941Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['timetaken_in_millisec'].info()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:38.169574Z","iopub.execute_input":"2024-06-29T05:55:38.170116Z","iopub.status.idle":"2024-06-29T05:55:38.409341Z","shell.execute_reply.started":"2024-06-29T05:55:38.170061Z","shell.execute_reply":"2024-06-29T05:55:38.408106Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"## Imputing NaN values with mean\nimputer = SimpleImputer(strategy='mean')\nX_train['timetaken_in_millisec'] = imputer.fit_transform(X_train[['timetaken_in_millisec']])\nX_train['timetaken_in_millisec'] = X_train['timetaken_in_millisec'].astype('float64')\n\n\n\nX_valid_train['timetaken_in_millisec'] = imputer.transform(X_valid_train[['timetaken_in_millisec']])\nX_valid_train['timetaken_in_millisec'] = X_valid_train['timetaken_in_millisec'].astype('float64')\n\n\nresult_test_df['timetaken_in_millisec'] = imputer.transform(result_test_df[['timetaken_in_millisec']])\nresult_test_df['timetaken_in_millisec'] = result_test_df['timetaken_in_millisec'].astype('float64')","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:38.411011Z","iopub.execute_input":"2024-06-29T05:55:38.411911Z","iopub.status.idle":"2024-06-29T05:55:39.247192Z","shell.execute_reply.started":"2024-06-29T05:55:38.411862Z","shell.execute_reply":"2024-06-29T05:55:39.245852Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['timetaken_in_millisec'] = pd.DataFrame((pd.to_timedelta(X_train['timetaken_in_millisec']).dt.total_seconds()),index=X_train.index,columns=['timetaken_in_millisec'])\nX_train['timetaken_in_millisec']\n\nX_valid_train['timetaken_in_millisec'] = pd.DataFrame((pd.to_timedelta(X_valid_train['timetaken_in_millisec']).dt.total_seconds()),index=X_valid_train.index,columns=['timetaken_in_millisec'])\n\n\nresult_test_df['timetaken_in_millisec'] = pd.DataFrame((pd.to_timedelta(result_test_df['timetaken_in_millisec']).dt.total_seconds()),index=result_test_df.index,columns=['timetaken_in_millisec'])","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:45.197591Z","iopub.execute_input":"2024-06-29T05:55:45.198050Z","iopub.status.idle":"2024-06-29T05:55:48.779824Z","shell.execute_reply.started":"2024-06-29T05:55:45.198015Z","shell.execute_reply":"2024-06-29T05:55:48.778565Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['timetaken_in_millisec'].head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:55:51.511940Z","iopub.execute_input":"2024-06-29T05:55:51.512354Z","iopub.status.idle":"2024-06-29T05:55:51.522172Z","shell.execute_reply.started":"2024-06-29T05:55:51.512323Z","shell.execute_reply":"2024-06-29T05:55:51.520878Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_valid_train['timetaken_in_millisec'].head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:56:01.047644Z","iopub.execute_input":"2024-06-29T05:56:01.048078Z","iopub.status.idle":"2024-06-29T05:56:01.058083Z","shell.execute_reply.started":"2024-06-29T05:56:01.048042Z","shell.execute_reply":"2024-06-29T05:56:01.056825Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# X_train['timetaken_in_millisec'] = (X_train['timetaken_in_millisec']/60000)\n\n# X_valid_train['timetaken_in_millisec'] = (X_valid_train['timetaken_in_millisec']/60000)\n\n# result_test_df['timetaken_in_millisec'] = (result_test_df['timetaken_in_millisec']/60000)","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:48:35.510447Z","iopub.execute_input":"2024-06-29T05:48:35.510859Z","iopub.status.idle":"2024-06-29T05:48:35.522612Z","shell.execute_reply.started":"2024-06-29T05:48:35.510825Z","shell.execute_reply":"2024-06-29T05:48:35.521287Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:56:10.172235Z","iopub.execute_input":"2024-06-29T05:56:10.172686Z","iopub.status.idle":"2024-06-29T05:56:10.199516Z","shell.execute_reply.started":"2024-06-29T05:56:10.172648Z","shell.execute_reply":"2024-06-29T05:56:10.198393Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['fastestLapTime'].info()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:48:37.157382Z","iopub.execute_input":"2024-06-29T05:48:37.157787Z","iopub.status.idle":"2024-06-29T05:48:37.373145Z","shell.execute_reply.started":"2024-06-29T05:48:37.157757Z","shell.execute_reply":"2024-06-29T05:48:37.371893Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['fastestLapTime'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:56:29.537585Z","iopub.execute_input":"2024-06-29T05:56:29.538386Z","iopub.status.idle":"2024-06-29T05:56:29.746867Z","shell.execute_reply.started":"2024-06-29T05:56:29.538346Z","shell.execute_reply":"2024-06-29T05:56:29.745483Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def extract_minutes(time_string):\n    if not pd.isna(time_string):\n        minutes, seconds = time_string.split(':')\n        minutes = float(minutes)\n        seconds = float(seconds)/100\n        total_time = minutes+seconds\n        return total_time\n\nX_train['fastestLapTime'] = X_train['fastestLapTime'].apply(extract_minutes)\n\n\nX_valid_train['fastestLapTime'] = X_valid_train['fastestLapTime'].apply(extract_minutes)\n\nresult_test_df['fastestLapTime'] = result_test_df['fastestLapTime'].apply(extract_minutes)\n\nX_train['fastestLapTime']","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:56:39.095560Z","iopub.execute_input":"2024-06-29T05:56:39.096557Z","iopub.status.idle":"2024-06-29T05:56:43.894845Z","shell.execute_reply.started":"2024-06-29T05:56:39.096494Z","shell.execute_reply":"2024-06-29T05:56:43.893511Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['fastestLapTime'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:56:43.897070Z","iopub.execute_input":"2024-06-29T05:56:43.897570Z","iopub.status.idle":"2024-06-29T05:56:43.952100Z","shell.execute_reply.started":"2024-06-29T05:56:43.897526Z","shell.execute_reply":"2024-06-29T05:56:43.950906Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['fastestLapTime'] = imputer.fit_transform(X_train[['fastestLapTime']])\nX_train['fastestLapTime'] = X_train['fastestLapTime'].astype('float64')\nX_train['fastestLapTime']\n\nX_valid_train['fastestLapTime'] = imputer.transform(X_valid_train[['fastestLapTime']])\nX_valid_train['fastestLapTime'] = X_valid_train['fastestLapTime'].astype('float64')\nX_valid_train['fastestLapTime']\n\n\nresult_test_df['fastestLapTime'] = imputer.transform(result_test_df[['fastestLapTime']])\nresult_test_df['fastestLapTime'] = result_test_df['fastestLapTime'].astype('float64')","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:56:51.542288Z","iopub.execute_input":"2024-06-29T05:56:51.542714Z","iopub.status.idle":"2024-06-29T05:56:51.705312Z","shell.execute_reply.started":"2024-06-29T05:56:51.542679Z","shell.execute_reply":"2024-06-29T05:56:51.703888Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['max_speed'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:56:53.477387Z","iopub.execute_input":"2024-06-29T05:56:53.477806Z","iopub.status.idle":"2024-06-29T05:56:53.683368Z","shell.execute_reply.started":"2024-06-29T05:56:53.477772Z","shell.execute_reply":"2024-06-29T05:56:53.682239Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['max_speed'].info()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:56:58.012103Z","iopub.execute_input":"2024-06-29T05:56:58.012598Z","iopub.status.idle":"2024-06-29T05:56:58.233499Z","shell.execute_reply.started":"2024-06-29T05:56:58.012565Z","shell.execute_reply":"2024-06-29T05:56:58.232244Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"most_frequent_imputer = SimpleImputer(strategy = 'most_frequent')\nX_train[\"max_speed\"] = pd.DataFrame(most_frequent_imputer.fit_transform(X_train[[\"max_speed\"]]),columns=[\"max_speed\"],index=X_train.index).astype(np.float64)\n\n\nX_valid_train[\"max_speed\"] = pd.DataFrame(most_frequent_imputer.transform(X_valid_train[[\"max_speed\"]]),columns=[\"max_speed\"],index=X_valid_train.index).astype(np.float64)\n\n\nresult_test_df[\"max_speed\"] = pd.DataFrame(most_frequent_imputer.transform(result_test_df[[\"max_speed\"]]),columns=[\"max_speed\"],index=result_test_df.index).astype(np.float64)","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:57:11.052919Z","iopub.execute_input":"2024-06-29T05:57:11.053360Z","iopub.status.idle":"2024-06-29T05:57:12.244173Z","shell.execute_reply.started":"2024-06-29T05:57:11.053323Z","shell.execute_reply":"2024-06-29T05:57:12.243059Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:57:14.887642Z","iopub.execute_input":"2024-06-29T05:57:14.888165Z","iopub.status.idle":"2024-06-29T05:57:14.924321Z","shell.execute_reply.started":"2024-06-29T05:57:14.888121Z","shell.execute_reply":"2024-06-29T05:57:14.923261Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":" X_train[\"max_speed\"].value_counts()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:57:19.333122Z","iopub.execute_input":"2024-06-29T05:57:19.333560Z","iopub.status.idle":"2024-06-29T05:57:19.410043Z","shell.execute_reply.started":"2024-06-29T05:57:19.333527Z","shell.execute_reply":"2024-06-29T05:57:19.408637Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.info()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:57:27.707667Z","iopub.execute_input":"2024-06-29T05:57:27.708097Z","iopub.status.idle":"2024-06-29T05:57:27.722034Z","shell.execute_reply.started":"2024-06-29T05:57:27.708061Z","shell.execute_reply":"2024-06-29T05:57:27.720871Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df[\"grand_prix\"].value_counts()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:57:27.966919Z","iopub.execute_input":"2024-06-29T05:57:27.967390Z","iopub.status.idle":"2024-06-29T05:57:28.494486Z","shell.execute_reply.started":"2024-06-29T05:57:27.967350Z","shell.execute_reply":"2024-06-29T05:57:28.493323Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"le = LabelEncoder()\nX_train['grand_prix'] = le.fit_transform(X_train['grand_prix'])\n\nX_valid_train['grand_prix'] = le.fit_transform(X_valid_train['grand_prix'])\n\nresult_test_df['grand_prix'] = le.fit_transform(result_test_df['grand_prix'])\n","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:57:30.917732Z","iopub.execute_input":"2024-06-29T05:57:30.919439Z","iopub.status.idle":"2024-06-29T05:57:31.958761Z","shell.execute_reply.started":"2024-06-29T05:57:30.919389Z","shell.execute_reply":"2024-06-29T05:57:31.957491Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['grand_prix'].info()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:57:32.972232Z","iopub.execute_input":"2024-06-29T05:57:32.973089Z","iopub.status.idle":"2024-06-29T05:57:32.996110Z","shell.execute_reply.started":"2024-06-29T05:57:32.973042Z","shell.execute_reply":"2024-06-29T05:57:32.995012Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['date'] = pd.to_datetime(X_train['date'])\n\nX_valid_train['date'] = pd.to_datetime(X_valid_train['date'])\n\nresult_test_df['date'] = pd.to_datetime(result_test_df['date'])\n\nX_train['date']","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:57:33.357275Z","iopub.execute_input":"2024-06-29T05:57:33.358318Z","iopub.status.idle":"2024-06-29T05:57:33.959010Z","shell.execute_reply.started":"2024-06-29T05:57:33.358276Z","shell.execute_reply":"2024-06-29T05:57:33.957865Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['year'] = (X_train['date'].dt.year).astype(np.int64)\nX_train['month'] = (X_train['date'].dt.month).astype(np.int64)\nX_train['day'] = (X_train['date'].dt.day).astype(np.int64)\n\n\nX_valid_train['year'] = (X_valid_train['date'].dt.year).astype(np.int64)\nX_valid_train['month'] = (X_valid_train['date'].dt.month).astype(np.int64)\nX_valid_train['day'] = (X_valid_train['date'].dt.day).astype(np.int64)\n\n\nresult_test_df['year'] = (result_test_df['date'].dt.year).astype(np.int64)\nresult_test_df['month'] = (result_test_df['date'].dt.month).astype(np.int64)\nresult_test_df['day'] = (result_test_df['date'].dt.day).astype(np.int64)","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:57:33.960897Z","iopub.execute_input":"2024-06-29T05:57:33.961268Z","iopub.status.idle":"2024-06-29T05:57:34.319151Z","shell.execute_reply.started":"2024-06-29T05:57:33.961234Z","shell.execute_reply":"2024-06-29T05:57:34.317820Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:57:42.147219Z","iopub.execute_input":"2024-06-29T05:57:42.147659Z","iopub.status.idle":"2024-06-29T05:57:42.176703Z","shell.execute_reply.started":"2024-06-29T05:57:42.147623Z","shell.execute_reply":"2024-06-29T05:57:42.175320Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.info()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:57:51.627296Z","iopub.execute_input":"2024-06-29T05:57:51.627720Z","iopub.status.idle":"2024-06-29T05:57:51.641481Z","shell.execute_reply.started":"2024-06-29T05:57:51.627685Z","shell.execute_reply":"2024-06-29T05:57:51.640314Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# ord_encoder = OrdinalEncoder()\n# X_train['date'] = ord_encoder.fit_transform(X_train[['date']]).astype(np.float64)\n\n\n\n# X_valid_train['date'] = ord_encoder.fit_transform(X_valid_train[['date']]).astype(np.float64)\n# X_valid_train['date'].value_counts()\n\n\n# result_test_df['date'] = ord_encoder.fit_transform(result_test_df[['date']]).astype(np.float64)","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:57:51.887066Z","iopub.execute_input":"2024-06-29T05:57:51.887482Z","iopub.status.idle":"2024-06-29T05:57:51.892643Z","shell.execute_reply.started":"2024-06-29T05:57:51.887451Z","shell.execute_reply":"2024-06-29T05:57:51.891404Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['full_name'] = X_train['forename'] + ' ' + X_train['surname']\nX_train.drop(columns=['forename','surname'], axis=1, inplace=True)\n\n\nX_valid_train['full_name'] = X_valid_train['forename'] + ' ' + X_valid_train['surname']\nX_valid_train.drop(columns=['forename','surname'], axis=1, inplace=True)\n\n\nresult_test_df['full_name'] = result_test_df['forename'] + ' ' + result_test_df['surname']\nresult_test_df.drop(columns=['forename','surname'], axis=1, inplace=True)\n","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:57:53.052002Z","iopub.execute_input":"2024-06-29T05:57:53.052438Z","iopub.status.idle":"2024-06-29T05:57:54.698106Z","shell.execute_reply.started":"2024-06-29T05:57:53.052401Z","shell.execute_reply":"2024-06-29T05:57:54.696624Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['full_name'] = le.fit_transform(X_train['full_name'])\nX_train['nationality'] = le.fit_transform(X_train['nationality'])","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:58:01.612287Z","iopub.execute_input":"2024-06-29T05:58:01.613344Z","iopub.status.idle":"2024-06-29T05:58:01.928969Z","shell.execute_reply.started":"2024-06-29T05:58:01.613303Z","shell.execute_reply":"2024-06-29T05:58:01.927757Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_valid_train['nationality'] = le.fit_transform(X_valid_train['nationality'])\nX_valid_train['full_name'] = le.fit_transform(X_valid_train['full_name'])\n","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:58:04.517639Z","iopub.execute_input":"2024-06-29T05:58:04.518095Z","iopub.status.idle":"2024-06-29T05:58:04.550469Z","shell.execute_reply.started":"2024-06-29T05:58:04.518056Z","shell.execute_reply":"2024-06-29T05:58:04.549161Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"result_test_df['nationality'] = le.fit_transform(result_test_df['nationality'])\nresult_test_df['full_name'] = le.fit_transform(result_test_df['full_name'])","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:58:05.852434Z","iopub.execute_input":"2024-06-29T05:58:05.852882Z","iopub.status.idle":"2024-06-29T05:58:06.089471Z","shell.execute_reply.started":"2024-06-29T05:58:05.852845Z","shell.execute_reply":"2024-06-29T05:58:06.088252Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.head()\n","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:58:07.652299Z","iopub.execute_input":"2024-06-29T05:58:07.652752Z","iopub.status.idle":"2024-06-29T05:58:07.681890Z","shell.execute_reply.started":"2024-06-29T05:58:07.652712Z","shell.execute_reply":"2024-06-29T05:58:07.680619Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['company'] = le.fit_transform(X_train['company'])\nX_train['nationality_y'] = le.fit_transform(X_train['nationality_y'])\nX_train['status'] = le.fit_transform(X_train['status'])\n\n\n\nX_valid_train['company'] = le.fit_transform(X_valid_train['company'])\nX_valid_train['nationality_y'] = le.fit_transform(X_valid_train['nationality_y'])\nX_valid_train['status'] = le.fit_transform(X_valid_train['status'])\n\nX_valid_train.head()\n\n\nresult_test_df['company'] = le.fit_transform(result_test_df['company'])\nresult_test_df['nationality_y'] = le.fit_transform(result_test_df['nationality_y'])\nresult_test_df['status'] = le.fit_transform(result_test_df['status'])","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:58:15.958016Z","iopub.execute_input":"2024-06-29T05:58:15.958476Z","iopub.status.idle":"2024-06-29T05:58:19.099414Z","shell.execute_reply.started":"2024-06-29T05:58:15.958440Z","shell.execute_reply":"2024-06-29T05:58:19.098476Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# X_train = X_train.rename(columns={'timetaken_in_millisec': 'time_taken'})\n\n# X_valid_train = X_valid_train.rename(columns={'timetaken_in_millisec': 'time_taken'})\n\n# result_test_df = result_test_df.rename(columns={'timetaken_in_millisec': 'time_taken'})\n","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:46:24.731441Z","iopub.execute_input":"2024-06-29T05:46:24.731790Z","iopub.status.idle":"2024-06-29T05:46:25.698209Z","shell.execute_reply.started":"2024-06-29T05:46:24.731761Z","shell.execute_reply":"2024-06-29T05:46:25.696904Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['grid'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:58:26.868051Z","iopub.execute_input":"2024-06-29T05:58:26.868552Z","iopub.status.idle":"2024-06-29T05:58:26.906789Z","shell.execute_reply.started":"2024-06-29T05:58:26.868512Z","shell.execute_reply":"2024-06-29T05:58:26.905606Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:58:28.772425Z","iopub.execute_input":"2024-06-29T05:58:28.772862Z","iopub.status.idle":"2024-06-29T05:58:28.798922Z","shell.execute_reply.started":"2024-06-29T05:58:28.772828Z","shell.execute_reply":"2024-06-29T05:58:28.797772Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train['wins'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:59:07.277967Z","iopub.execute_input":"2024-06-29T05:59:07.279012Z","iopub.status.idle":"2024-06-29T05:59:07.317232Z","shell.execute_reply.started":"2024-06-29T05:59:07.278969Z","shell.execute_reply":"2024-06-29T05:59:07.315873Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.info()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:59:07.556226Z","iopub.execute_input":"2024-06-29T05:59:07.556632Z","iopub.status.idle":"2024-06-29T05:59:07.569844Z","shell.execute_reply.started":"2024-06-29T05:59:07.556601Z","shell.execute_reply":"2024-06-29T05:59:07.568611Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# from sklearn.preprocessing import StandardScaler\n# scaler = StandardScaler()\n\n# columns_to_scale = ['points','laps','time_taken','fastestLapTime','max_speed','points_y']\n\n# X_train[columns_to_scale] = scaler.fit_transform(X_train[columns_to_scale])\n# X_valid_train[columns_to_scale] = scaler.fit_transform(X_valid_train[columns_to_scale])","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:59:07.915929Z","iopub.execute_input":"2024-06-29T05:59:07.916374Z","iopub.status.idle":"2024-06-29T05:59:07.922078Z","shell.execute_reply.started":"2024-06-29T05:59:07.916335Z","shell.execute_reply":"2024-06-29T05:59:07.920887Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# from sklearn.preprocessing import StandardScaler\n# scaler = StandardScaler()\n# scaled_data = scaler.fit_transform(X_train)\n# X_train_scaled = pd.DataFrame(scaled_data, columns=X_train.columns)","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:59:08.363769Z","iopub.execute_input":"2024-06-29T05:59:08.364216Z","iopub.status.idle":"2024-06-29T05:59:08.369577Z","shell.execute_reply.started":"2024-06-29T05:59:08.364154Z","shell.execute_reply":"2024-06-29T05:59:08.368341Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# scaled_data = scaler.fit_transform(X_valid_train)\n# X_valid_train_scaled = pd.DataFrame(scaled_data, columns=X_valid_train.columns)","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:59:08.637534Z","iopub.execute_input":"2024-06-29T05:59:08.637967Z","iopub.status.idle":"2024-06-29T05:59:08.643340Z","shell.execute_reply.started":"2024-06-29T05:59:08.637932Z","shell.execute_reply":"2024-06-29T05:59:08.642077Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"duplicate_labels = df.index[df.index.duplicated()]\nduplicate_labels","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:59:08.834572Z","iopub.execute_input":"2024-06-29T05:59:08.834973Z","iopub.status.idle":"2024-06-29T05:59:08.844512Z","shell.execute_reply.started":"2024-06-29T05:59:08.834941Z","shell.execute_reply":"2024-06-29T05:59:08.842882Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_valid_train.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:59:09.271749Z","iopub.execute_input":"2024-06-29T05:59:09.272842Z","iopub.status.idle":"2024-06-29T05:59:09.298527Z","shell.execute_reply.started":"2024-06-29T05:59:09.272800Z","shell.execute_reply":"2024-06-29T05:59:09.296706Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:59:09.543875Z","iopub.execute_input":"2024-06-29T05:59:09.544671Z","iopub.status.idle":"2024-06-29T05:59:09.569889Z","shell.execute_reply.started":"2024-06-29T05:59:09.544627Z","shell.execute_reply":"2024-06-29T05:59:09.568610Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nan_columns = X_train.isna().any()\nnan_columns","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:59:09.898340Z","iopub.execute_input":"2024-06-29T05:59:09.898843Z","iopub.status.idle":"2024-06-29T05:59:09.945254Z","shell.execute_reply.started":"2024-06-29T05:59:09.898804Z","shell.execute_reply":"2024-06-29T05:59:09.943916Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_train.value_counts()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:59:10.143845Z","iopub.execute_input":"2024-06-29T05:59:10.144321Z","iopub.status.idle":"2024-06-29T05:59:10.183354Z","shell.execute_reply.started":"2024-06-29T05:59:10.144282Z","shell.execute_reply":"2024-06-29T05:59:10.182029Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from sklearn.ensemble import GradientBoostingRegressor\nfrom sklearn.metrics import mean_squared_error, r2_score","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:59:10.334030Z","iopub.execute_input":"2024-06-29T05:59:10.334963Z","iopub.status.idle":"2024-06-29T05:59:10.340034Z","shell.execute_reply.started":"2024-06-29T05:59:10.334927Z","shell.execute_reply":"2024-06-29T05:59:10.338937Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"X_train.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:59:10.523681Z","iopub.execute_input":"2024-06-29T05:59:10.524127Z","iopub.status.idle":"2024-06-29T05:59:10.550169Z","shell.execute_reply.started":"2024-06-29T05:59:10.524088Z","shell.execute_reply":"2024-06-29T05:59:10.548859Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"gbr = GradientBoostingRegressor(n_estimators=100, learning_rate=0.1, max_depth=4, random_state=42,max_features=1.0)\ngbr.fit(X_train.drop(columns=['date']), y_train)","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:59:10.692513Z","iopub.execute_input":"2024-06-29T05:59:10.693483Z","iopub.status.idle":"2024-06-29T06:22:16.598570Z","shell.execute_reply.started":"2024-06-29T05:59:10.693442Z","shell.execute_reply":"2024-06-29T06:22:16.597240Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_pred_train = gbr.predict(X_valid_train.drop(columns=['date']))\nmse = mean_squared_error(y_valid_train, y_pred_train)\nrmse = np.sqrt(mse)","metadata":{"execution":{"iopub.status.busy":"2024-06-29T06:24:12.670312Z","iopub.execute_input":"2024-06-29T06:24:12.670835Z","iopub.status.idle":"2024-06-29T06:24:13.277233Z","shell.execute_reply.started":"2024-06-29T06:24:12.670794Z","shell.execute_reply":"2024-06-29T06:24:13.275989Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"mse","metadata":{"execution":{"iopub.status.busy":"2024-06-29T06:24:15.636899Z","iopub.execute_input":"2024-06-29T06:24:15.637337Z","iopub.status.idle":"2024-06-29T06:24:15.645968Z","shell.execute_reply.started":"2024-06-29T06:24:15.637300Z","shell.execute_reply":"2024-06-29T06:24:15.644518Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"rmse","metadata":{"execution":{"iopub.status.busy":"2024-06-29T06:24:18.109777Z","iopub.execute_input":"2024-06-29T06:24:18.110239Z","iopub.status.idle":"2024-06-29T06:24:18.117772Z","shell.execute_reply.started":"2024-06-29T06:24:18.110200Z","shell.execute_reply":"2024-06-29T06:24:18.116542Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_pred_test = gbr.predict(result_test_df.drop(columns=['date']))","metadata":{"execution":{"iopub.status.busy":"2024-06-29T06:24:38.622299Z","iopub.execute_input":"2024-06-29T06:24:38.623342Z","iopub.status.idle":"2024-06-29T06:24:39.225322Z","shell.execute_reply.started":"2024-06-29T06:24:38.623300Z","shell.execute_reply":"2024-06-29T06:24:39.224252Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"y_pred_test[:20]","metadata":{"execution":{"iopub.status.busy":"2024-06-29T06:24:39.523387Z","iopub.execute_input":"2024-06-29T06:24:39.523837Z","iopub.status.idle":"2024-06-29T06:24:39.532641Z","shell.execute_reply.started":"2024-06-29T06:24:39.523802Z","shell.execute_reply":"2024-06-29T06:24:39.531437Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"output = pd.DataFrame(\n{\n    \"position\":y_pred_test,\n    \"result_driver_standing\":result_test_df['result_driver_standing']\n})","metadata":{"execution":{"iopub.status.busy":"2024-06-29T06:24:42.210601Z","iopub.execute_input":"2024-06-29T06:24:42.211035Z","iopub.status.idle":"2024-06-29T06:24:42.218085Z","shell.execute_reply.started":"2024-06-29T06:24:42.210999Z","shell.execute_reply":"2024-06-29T06:24:42.216875Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"output.head()","metadata":{"execution":{"iopub.status.busy":"2024-06-29T06:24:44.539104Z","iopub.execute_input":"2024-06-29T06:24:44.539582Z","iopub.status.idle":"2024-06-29T06:24:44.551750Z","shell.execute_reply.started":"2024-06-29T06:24:44.539542Z","shell.execute_reply":"2024-06-29T06:24:44.550404Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"output.to_csv(\"submission.csv\",index= False)","metadata":{"execution":{"iopub.status.busy":"2024-06-29T06:24:48.415590Z","iopub.execute_input":"2024-06-29T06:24:48.416006Z","iopub.status.idle":"2024-06-29T06:24:49.643400Z","shell.execute_reply.started":"2024-06-29T06:24:48.415971Z","shell.execute_reply":"2024-06-29T06:24:49.642089Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"output.shape","metadata":{"execution":{"iopub.status.busy":"2024-06-29T05:31:39.404707Z","iopub.execute_input":"2024-06-29T05:31:39.405196Z","iopub.status.idle":"2024-06-29T05:31:39.413820Z","shell.execute_reply.started":"2024-06-29T05:31:39.405150Z","shell.execute_reply":"2024-06-29T05:31:39.412441Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}