{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd \nimport numpy as np\nfrom sklearn.linear_model import LinearRegression","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-10-12T15:16:15.626217Z","iopub.execute_input":"2021-10-12T15:16:15.627417Z","iopub.status.idle":"2021-10-12T15:16:16.631270Z","shell.execute_reply.started":"2021-10-12T15:16:15.627362Z","shell.execute_reply":"2021-10-12T15:16:16.630211Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_dt = pd.read_csv('../input/departure-delay2/x_test.csv')\ntrain_dt = pd.read_csv('../input/departure-delay2/x_train.csv')\ntarget = pd.read_csv('../input/departure-delay2/y_train.csv', index_col='id')","metadata":{"execution":{"iopub.status.busy":"2021-10-12T15:20:51.097070Z","iopub.execute_input":"2021-10-12T15:20:51.097331Z","iopub.status.idle":"2021-10-12T15:20:56.132287Z","shell.execute_reply.started":"2021-10-12T15:20:51.097303Z","shell.execute_reply":"2021-10-12T15:20:56.131656Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"target","metadata":{"execution":{"iopub.status.busy":"2021-10-12T15:21:03.178807Z","iopub.execute_input":"2021-10-12T15:21:03.179078Z","iopub.status.idle":"2021-10-12T15:21:03.189264Z","shell.execute_reply.started":"2021-10-12T15:21:03.179051Z","shell.execute_reply":"2021-10-12T15:21:03.188742Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_dt.info()","metadata":{"execution":{"iopub.status.busy":"2021-10-12T15:08:32.159203Z","iopub.execute_input":"2021-10-12T15:08:32.160082Z","iopub.status.idle":"2021-10-12T15:08:32.361572Z","shell.execute_reply.started":"2021-10-12T15:08:32.160042Z","shell.execute_reply":"2021-10-12T15:08:32.360791Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_train = train_dt.drop(['UniqueCarrier', 'TailNum', 'Origin', 'Dest', 'CancellationCode'], axis=1)\nx_test = test_dt.drop(['UniqueCarrier', 'TailNum', 'Origin', 'Dest', 'CancellationCode'], axis=1)","metadata":{"execution":{"iopub.status.busy":"2021-10-12T15:13:23.985534Z","iopub.execute_input":"2021-10-12T15:13:23.986240Z","iopub.status.idle":"2021-10-12T15:13:24.170636Z","shell.execute_reply.started":"2021-10-12T15:13:23.986195Z","shell.execute_reply":"2021-10-12T15:13:24.170020Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_train.fillna(0, inplace=True)\nx_test.fillna(0, inplace=True)","metadata":{"execution":{"iopub.status.busy":"2021-10-12T15:18:55.196560Z","iopub.execute_input":"2021-10-12T15:18:55.196866Z","iopub.status.idle":"2021-10-12T15:18:55.319527Z","shell.execute_reply.started":"2021-10-12T15:18:55.196834Z","shell.execute_reply":"2021-10-12T15:18:55.318601Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"lrg  = LinearRegression().fit(x_train, target)","metadata":{"execution":{"iopub.status.busy":"2021-10-12T15:21:16.307771Z","iopub.execute_input":"2021-10-12T15:21:16.309781Z","iopub.status.idle":"2021-10-12T15:21:17.381720Z","shell.execute_reply.started":"2021-10-12T15:21:16.309723Z","shell.execute_reply":"2021-10-12T15:21:17.380782Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predict = lrg.predict(x_test)","metadata":{"execution":{"iopub.status.busy":"2021-10-12T15:21:17.453260Z","iopub.execute_input":"2021-10-12T15:21:17.453533Z","iopub.status.idle":"2021-10-12T15:21:17.505166Z","shell.execute_reply.started":"2021-10-12T15:21:17.453505Z","shell.execute_reply":"2021-10-12T15:21:17.504172Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"predict  = predict.flatten()","metadata":{"execution":{"iopub.status.busy":"2021-10-12T15:24:22.945585Z","iopub.execute_input":"2021-10-12T15:24:22.946146Z","iopub.status.idle":"2021-10-12T15:24:22.950062Z","shell.execute_reply.started":"2021-10-12T15:24:22.946113Z","shell.execute_reply":"2021-10-12T15:24:22.949336Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.Series(predict, name='DelayTime').to_csv('predict.csv', index_label='id', header=True)","metadata":{"execution":{"iopub.status.busy":"2021-10-12T15:24:23.717426Z","iopub.execute_input":"2021-10-12T15:24:23.718237Z","iopub.status.idle":"2021-10-12T15:24:25.209233Z","shell.execute_reply.started":"2021-10-12T15:24:23.718199Z","shell.execute_reply":"2021-10-12T15:24:25.208181Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}