{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.14","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":84896,"databundleVersionId":10305135,"sourceType":"competition"}],"dockerImageVersionId":30804,"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\nimport numpy as np # linear algebra\nimport pandas as pd # 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","trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:43.161022Z","iopub.execute_input":"2024-12-05T15:51:43.161696Z","iopub.status.idle":"2024-12-05T15:51:43.186251Z","shell.execute_reply.started":"2024-12-05T15:51:43.161627Z","shell.execute_reply":"2024-12-05T15:51:43.184208Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"data1=pd.read_csv('/kaggle/input/playground-series-s4e12/train.csv')\ndf1=pd.DataFrame(data1)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:43.192291Z","iopub.execute_input":"2024-12-05T15:51:43.192915Z","iopub.status.idle":"2024-12-05T15:51:47.841416Z","shell.execute_reply.started":"2024-12-05T15:51:43.19285Z","shell.execute_reply":"2024-12-05T15:51:47.840276Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df1['Previous Claims'] = df1['Previous Claims'].fillna(0)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:47.842832Z","iopub.execute_input":"2024-12-05T15:51:47.84327Z","iopub.status.idle":"2024-12-05T15:51:47.856647Z","shell.execute_reply.started":"2024-12-05T15:51:47.843221Z","shell.execute_reply":"2024-12-05T15:51:47.855435Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df1=df1.drop('Policy Start Date',axis=1)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:47.858042Z","iopub.execute_input":"2024-12-05T15:51:47.858384Z","iopub.status.idle":"2024-12-05T15:51:48.019673Z","shell.execute_reply.started":"2024-12-05T15:51:47.85834Z","shell.execute_reply":"2024-12-05T15:51:48.018587Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#df1去掉了id，时间\ndf1=df1.drop('id',axis=1)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:48.023381Z","iopub.execute_input":"2024-12-05T15:51:48.024046Z","iopub.status.idle":"2024-12-05T15:51:48.209245Z","shell.execute_reply.started":"2024-12-05T15:51:48.024009Z","shell.execute_reply":"2024-12-05T15:51:48.208179Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"from sklearn.preprocessing import OneHotEncoder","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:48.210374Z","iopub.execute_input":"2024-12-05T15:51:48.21074Z","iopub.status.idle":"2024-12-05T15:51:48.215203Z","shell.execute_reply.started":"2024-12-05T15:51:48.210708Z","shell.execute_reply":"2024-12-05T15:51:48.214223Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#df2是原始数据独热编码\ncategorical_columns = [\n    'Gender', 'Education Level', 'Occupation', 'Location', 'Policy Type',\n    'Customer Feedback', 'Smoking Status', 'Exercise Frequency', 'Property Type','Marital Status'\n]\n\n# 使用pandas的get_dummies函数进行独热编码\n# 设置drop_first=True以避免共线性\ndf2= pd.get_dummies(df1, columns=categorical_columns, drop_first=True)\n\nprint(df2)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:48.216758Z","iopub.execute_input":"2024-12-05T15:51:48.217047Z","iopub.status.idle":"2024-12-05T15:51:49.57202Z","shell.execute_reply.started":"2024-12-05T15:51:48.217018Z","shell.execute_reply":"2024-12-05T15:51:49.570966Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#df3是去掉空值，id，时间，独热编码\ndf3 = df2.dropna()","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:49.573599Z","iopub.execute_input":"2024-12-05T15:51:49.574053Z","iopub.status.idle":"2024-12-05T15:51:49.672344Z","shell.execute_reply.started":"2024-12-05T15:51:49.574003Z","shell.execute_reply":"2024-12-05T15:51:49.671382Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"import xgboost as xgb\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import mean_squared_error\n\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:49.673496Z","iopub.execute_input":"2024-12-05T15:51:49.673815Z","iopub.status.idle":"2024-12-05T15:51:49.678461Z","shell.execute_reply.started":"2024-12-05T15:51:49.673784Z","shell.execute_reply":"2024-12-05T15:51:49.677415Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# 分离特征和目标变量\nX = df3.drop('Premium Amount', axis=1)  # 特征\ny = df3['Premium Amount']  # 目标变量\n\n# 划分训练集和测试集\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:49.679796Z","iopub.execute_input":"2024-12-05T15:51:49.680065Z","iopub.status.idle":"2024-12-05T15:51:49.899664Z","shell.execute_reply.started":"2024-12-05T15:51:49.680037Z","shell.execute_reply":"2024-12-05T15:51:49.898556Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# 创建XGBoost回归模型实例\nxgb_regressor = xgb.XGBRegressor(\n    n_estimators=100,\n    max_depth=6,\n    learning_rate=0.1,\n    subsample=0.8,\n    colsample_bytree=0.8,\n    random_state=42\n)\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:49.901121Z","iopub.execute_input":"2024-12-05T15:51:49.901891Z","iopub.status.idle":"2024-12-05T15:51:49.907474Z","shell.execute_reply.started":"2024-12-05T15:51:49.901832Z","shell.execute_reply":"2024-12-05T15:51:49.906432Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# 训练模型\nxgb_regressor.fit(X_train, y_train)\n\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:49.908932Z","iopub.execute_input":"2024-12-05T15:51:49.909321Z","iopub.status.idle":"2024-12-05T15:51:55.410296Z","shell.execute_reply.started":"2024-12-05T15:51:49.909278Z","shell.execute_reply":"2024-12-05T15:51:55.408253Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# 进行预测\ny_pred = xgb_regressor.predict(X_test)\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:55.411213Z","iopub.execute_input":"2024-12-05T15:51:55.41152Z","iopub.status.idle":"2024-12-05T15:51:55.916296Z","shell.execute_reply.started":"2024-12-05T15:51:55.411489Z","shell.execute_reply":"2024-12-05T15:51:55.915263Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# 定义计算RMSLE的函数\ndef rmsle(y_true, y_pred):\n    log_pred = np.log1p(y_pred)\n    log_true = np.log1p(y_true)\n    squared_error = (log_pred - log_true) ** 2\n    mean_squared_error = np.mean(squared_error)\n    return np.sqrt(mean_squared_error)\n\n# 评估模型性能 - RMSLE\nrmsle_value = rmsle(y_test, y_pred)\nprint(f\"Root Mean Squared Log Error (RMSLE): {rmsle_value}\")\n#非空部分的RMSLE是1.1426121472633592","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:55.922109Z","iopub.execute_input":"2024-12-05T15:51:55.922733Z","iopub.status.idle":"2024-12-05T15:51:55.941672Z","shell.execute_reply.started":"2024-12-05T15:51:55.922688Z","shell.execute_reply":"2024-12-05T15:51:55.940606Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"data2=pd.read_csv('/kaggle/input/playground-series-s4e12/test.csv')\ndftest=pd.DataFrame(data2)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:55.942927Z","iopub.execute_input":"2024-12-05T15:51:55.943237Z","iopub.status.idle":"2024-12-05T15:51:58.731163Z","shell.execute_reply.started":"2024-12-05T15:51:55.943207Z","shell.execute_reply":"2024-12-05T15:51:58.730191Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dftest1 = dftest.dropna()\ndftest11=dftest1.drop(['id','Policy Start Date'],axis=1)\n#dftest1是去掉空值行，dftest11是去掉id和日期，去掉空值","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:58.732483Z","iopub.execute_input":"2024-12-05T15:51:58.732814Z","iopub.status.idle":"2024-12-05T15:51:59.209091Z","shell.execute_reply.started":"2024-12-05T15:51:58.732782Z","shell.execute_reply":"2024-12-05T15:51:59.207958Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"categorical_columns = [\n    'Gender', 'Education Level', 'Occupation', 'Location', 'Policy Type','Customer Feedback', 'Smoking Status', 'Exercise Frequency', 'Property Type','Marital Status'\n]\n\n# 使用pandas的get_dummies函数进行独热编码\n# 设置drop_first=True以避免共线性\ndftest111= pd.get_dummies(dftest11, columns=categorical_columns, drop_first=True)\n#df111独热编码，去掉id，日期，去掉空值\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:59.210696Z","iopub.execute_input":"2024-12-05T15:51:59.21112Z","iopub.status.idle":"2024-12-05T15:51:59.433811Z","shell.execute_reply.started":"2024-12-05T15:51:59.211074Z","shell.execute_reply":"2024-12-05T15:51:59.432421Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"\n# 使用模型进行预测\npredictions = xgb_regressor.predict(dftest111)\n\n# 现在predictions包含了dfnew的预测结果\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:51:59.435276Z","iopub.execute_input":"2024-12-05T15:51:59.435699Z","iopub.status.idle":"2024-12-05T15:52:00.217434Z","shell.execute_reply.started":"2024-12-05T15:51:59.435652Z","shell.execute_reply":"2024-12-05T15:52:00.216625Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"predictions\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:00.218299Z","iopub.execute_input":"2024-12-05T15:52:00.218605Z","iopub.status.idle":"2024-12-05T15:52:00.229424Z","shell.execute_reply.started":"2024-12-05T15:52:00.218574Z","shell.execute_reply":"2024-12-05T15:52:00.228778Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# 使用 .loc 来设置 '预测' 列的值\ndftest1.loc[:, '预测'] = predictions\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:00.230235Z","iopub.execute_input":"2024-12-05T15:52:00.230535Z","iopub.status.idle":"2024-12-05T15:52:00.239524Z","shell.execute_reply.started":"2024-12-05T15:52:00.230505Z","shell.execute_reply":"2024-12-05T15:52:00.238335Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dftest1\n#非空部分预测结束","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:00.241192Z","iopub.execute_input":"2024-12-05T15:52:00.241593Z","iopub.status.idle":"2024-12-05T15:52:00.392443Z","shell.execute_reply.started":"2024-12-05T15:52:00.241548Z","shell.execute_reply":"2024-12-05T15:52:00.391319Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"features=['Age', 'Annual Income', 'Number of Dependents', 'Health Score',\n       'Previous Claims', 'Credit Score']","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:00.39384Z","iopub.execute_input":"2024-12-05T15:52:00.39563Z","iopub.status.idle":"2024-12-05T15:52:00.400221Z","shell.execute_reply.started":"2024-12-05T15:52:00.395594Z","shell.execute_reply":"2024-12-05T15:52:00.399207Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#开始空值部分，先建立模型\n#df11是原始数据表去掉所有有空值的列\ndf11=df1.drop(features,axis=1)\ndf11","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:00.401382Z","iopub.execute_input":"2024-12-05T15:52:00.401696Z","iopub.status.idle":"2024-12-05T15:52:00.555728Z","shell.execute_reply.started":"2024-12-05T15:52:00.401666Z","shell.execute_reply":"2024-12-05T15:52:00.554677Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#独热编码df111\ncategorical_columns = [\n    'Gender', 'Education Level', 'Occupation', 'Location', 'Policy Type',\n    'Customer Feedback', 'Smoking Status', 'Exercise Frequency', 'Property Type','Marital Status'\n]\n\n# 使用pandas的get_dummies函数进行独热编码\n# 设置drop_first=True以避免共线性\ndf111= pd.get_dummies(df11, columns=categorical_columns, drop_first=True)\n\nprint(df111)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:00.556845Z","iopub.execute_input":"2024-12-05T15:52:00.557119Z","iopub.status.idle":"2024-12-05T15:52:01.737266Z","shell.execute_reply.started":"2024-12-05T15:52:00.557091Z","shell.execute_reply":"2024-12-05T15:52:01.736191Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#进行空部分的训练\n# 分离特征和目标变量\nX = df111.drop('Premium Amount', axis=1)  # 特征\ny = df111['Premium Amount']  # 目标变量\n\n# 划分训练集和测试集\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\n\n# 创建XGBoost回归模型实例\nxgb_regressor2 = xgb.XGBRegressor(\n    n_estimators=100,\n    max_depth=6,\n    learning_rate=0.1,\n    subsample=0.8,\n    colsample_bytree=0.8,\n    random_state=42\n)\n# 训练模型\nxgb_regressor2.fit(X_train, y_train)\n# 进行预测\ny_pred = xgb_regressor2.predict(X_test)\n# 定义计算RMSLE的函数\ndef rmsle(y_true, y_pred):\n    log_pred = np.log1p(y_pred)\n    log_true = np.log1p(y_true)\n    squared_error = (log_pred - log_true) ** 2\n    mean_squared_error = np.mean(squared_error)\n    return np.sqrt(mean_squared_error)\n\n# 评估模型性能 - RMSLE\nrmsle_value = rmsle(y_test, y_pred)\nprint(f\"Root Mean Squared Log Error (RMSLE): {rmsle_value}\")\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:01.7388Z","iopub.execute_input":"2024-12-05T15:52:01.739494Z","iopub.status.idle":"2024-12-05T15:52:14.459691Z","shell.execute_reply.started":"2024-12-05T15:52:01.739446Z","shell.execute_reply":"2024-12-05T15:52:14.45863Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#训练完了不考虑有空值的行\n#先找出来有空值的行\ndftest2= dftest[dftest.isnull().any(axis=1)]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:14.460888Z","iopub.execute_input":"2024-12-05T15:52:14.461209Z","iopub.status.idle":"2024-12-05T15:52:14.967286Z","shell.execute_reply.started":"2024-12-05T15:52:14.461178Z","shell.execute_reply":"2024-12-05T15:52:14.966507Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dftest2","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:14.968668Z","iopub.execute_input":"2024-12-05T15:52:14.969034Z","iopub.status.idle":"2024-12-05T15:52:14.994335Z","shell.execute_reply.started":"2024-12-05T15:52:14.968999Z","shell.execute_reply":"2024-12-05T15:52:14.993403Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#独热编码dftest22\n\ncategorical_columns = [\n    'Gender', 'Education Level', 'Occupation', 'Location', 'Policy Type','Customer Feedback', 'Smoking Status', 'Exercise Frequency', 'Property Type','Marital Status'\n]\n\n# 使用pandas的get_dummies函数进行独热编码\n# 设置drop_first=True以避免共线性\ndftest22= pd.get_dummies(dftest2, columns=categorical_columns, drop_first=True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:14.995849Z","iopub.execute_input":"2024-12-05T15:52:14.996728Z","iopub.status.idle":"2024-12-05T15:52:15.594Z","shell.execute_reply.started":"2024-12-05T15:52:14.996677Z","shell.execute_reply":"2024-12-05T15:52:15.592876Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dftest222=dftest22.drop(['id','Policy Start Date'],axis=1)\ndftest222=dftest222.drop(features,axis=1) ","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:15.595517Z","iopub.execute_input":"2024-12-05T15:52:15.595979Z","iopub.status.idle":"2024-12-05T15:52:15.639298Z","shell.execute_reply.started":"2024-12-05T15:52:15.595929Z","shell.execute_reply":"2024-12-05T15:52:15.638248Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"#应用模型# 使用模型进行预测\npredictions = xgb_regressor2.predict(dftest222)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:15.640639Z","iopub.execute_input":"2024-12-05T15:52:15.641015Z","iopub.status.idle":"2024-12-05T15:52:17.12122Z","shell.execute_reply.started":"2024-12-05T15:52:15.640975Z","shell.execute_reply":"2024-12-05T15:52:17.120238Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dftest22['预测']=predictions","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:17.122588Z","iopub.execute_input":"2024-12-05T15:52:17.122961Z","iopub.status.idle":"2024-12-05T15:52:17.132829Z","shell.execute_reply.started":"2024-12-05T15:52:17.122925Z","shell.execute_reply":"2024-12-05T15:52:17.131671Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dftest22","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:17.135402Z","iopub.execute_input":"2024-12-05T15:52:17.135848Z","iopub.status.idle":"2024-12-05T15:52:17.303738Z","shell.execute_reply.started":"2024-12-05T15:52:17.135791Z","shell.execute_reply":"2024-12-05T15:52:17.302589Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dfanswer1=dftest22[['id','预测']]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:17.305087Z","iopub.execute_input":"2024-12-05T15:52:17.30543Z","iopub.status.idle":"2024-12-05T15:52:17.313605Z","shell.execute_reply.started":"2024-12-05T15:52:17.305397Z","shell.execute_reply":"2024-12-05T15:52:17.312562Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dfanswer2=dftest1[['id','预测']] ","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:17.314934Z","iopub.execute_input":"2024-12-05T15:52:17.315231Z","iopub.status.idle":"2024-12-05T15:52:17.325704Z","shell.execute_reply.started":"2024-12-05T15:52:17.3152Z","shell.execute_reply":"2024-12-05T15:52:17.324755Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dfanswer1","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:17.327249Z","iopub.execute_input":"2024-12-05T15:52:17.327932Z","iopub.status.idle":"2024-12-05T15:52:17.345482Z","shell.execute_reply.started":"2024-12-05T15:52:17.327863Z","shell.execute_reply":"2024-12-05T15:52:17.344298Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"dfanswer2","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:17.346816Z","iopub.execute_input":"2024-12-05T15:52:17.3472Z","iopub.status.idle":"2024-12-05T15:52:17.364845Z","shell.execute_reply.started":"2024-12-05T15:52:17.347158Z","shell.execute_reply":"2024-12-05T15:52:17.363621Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_concatenated = pd.concat([dfanswer1, dfanswer2], ignore_index=False)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:17.366221Z","iopub.execute_input":"2024-12-05T15:52:17.366624Z","iopub.status.idle":"2024-12-05T15:52:17.382056Z","shell.execute_reply.started":"2024-12-05T15:52:17.366562Z","shell.execute_reply":"2024-12-05T15:52:17.380991Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_concatenated","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:17.383618Z","iopub.execute_input":"2024-12-05T15:52:17.384443Z","iopub.status.idle":"2024-12-05T15:52:17.396374Z","shell.execute_reply.started":"2024-12-05T15:52:17.384394Z","shell.execute_reply":"2024-12-05T15:52:17.39521Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_concatenated.rename(columns={'预测': 'Premium Amount'}, inplace=True)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:17.39779Z","iopub.execute_input":"2024-12-05T15:52:17.398175Z","iopub.status.idle":"2024-12-05T15:52:17.407553Z","shell.execute_reply.started":"2024-12-05T15:52:17.398133Z","shell.execute_reply":"2024-12-05T15:52:17.406513Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_concatenated","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:17.408943Z","iopub.execute_input":"2024-12-05T15:52:17.409429Z","iopub.status.idle":"2024-12-05T15:52:17.426729Z","shell.execute_reply.started":"2024-12-05T15:52:17.409384Z","shell.execute_reply":"2024-12-05T15:52:17.425601Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_concatenated.to_csv('/kaggle/working/sample_submission.csv', index=False)\n","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-12-05T15:52:17.432068Z","iopub.execute_input":"2024-12-05T15:52:17.432445Z","iopub.status.idle":"2024-12-05T15:52:18.60876Z","shell.execute_reply.started":"2024-12-05T15:52:17.432411Z","shell.execute_reply":"2024-12-05T15:52:18.607891Z"}},"outputs":[],"execution_count":null}]}