{"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":"# 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","execution":{"iopub.status.busy":"2022-07-10T10:43:59.569406Z","iopub.execute_input":"2022-07-10T10:43:59.570241Z","iopub.status.idle":"2022-07-10T10:43:59.583643Z","shell.execute_reply.started":"2022-07-10T10:43:59.570195Z","shell.execute_reply":"2022-07-10T10:43:59.582767Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#test_preds = pd.read_csv('/kaggle/input/amexsample-submission/submission-agg.csv')\n#test_preds = pd.read_csv('/kaggle/input/amexsample-submission/submission-agg1.csv')\n\ntest_preds = pd.read_csv('/kaggle/input/amexsample-submission/submission-allraw-1.csv')","metadata":{"execution":{"iopub.status.busy":"2022-07-10T10:44:22.867545Z","iopub.execute_input":"2022-07-10T10:44:22.867914Z","iopub.status.idle":"2022-07-10T10:44:24.779868Z","shell.execute_reply.started":"2022-07-10T10:44:22.867882Z","shell.execute_reply":"2022-07-10T10:44:24.77889Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission = pd.read_csv('/kaggle/input/amex-default-prediction/sample_submission.csv')\nsubmission.shape","metadata":{"execution":{"iopub.status.busy":"2022-07-10T10:44:24.781858Z","iopub.execute_input":"2022-07-10T10:44:24.782845Z","iopub.status.idle":"2022-07-10T10:44:26.437042Z","shell.execute_reply.started":"2022-07-10T10:44:24.78281Z","shell.execute_reply":"2022-07-10T10:44:26.435794Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission = submission[['customer_ID']].merge(test_preds[['customer_ID', 'prediction']], \n                                               on=['customer_ID'], how='left')","metadata":{"execution":{"iopub.status.busy":"2022-07-10T10:44:26.438246Z","iopub.execute_input":"2022-07-10T10:44:26.43864Z","iopub.status.idle":"2022-07-10T10:44:27.445252Z","shell.execute_reply.started":"2022-07-10T10:44:26.438612Z","shell.execute_reply":"2022-07-10T10:44:27.444256Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.shape","metadata":{"execution":{"iopub.status.busy":"2022-07-10T10:44:27.448198Z","iopub.execute_input":"2022-07-10T10:44:27.449004Z","iopub.status.idle":"2022-07-10T10:44:27.45568Z","shell.execute_reply.started":"2022-07-10T10:44:27.448967Z","shell.execute_reply":"2022-07-10T10:44:27.454365Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-10T10:44:27.456886Z","iopub.execute_input":"2022-07-10T10:44:27.457158Z","iopub.status.idle":"2022-07-10T10:44:27.51711Z","shell.execute_reply.started":"2022-07-10T10:44:27.457132Z","shell.execute_reply":"2022-07-10T10:44:27.515985Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.fillna(value=0, inplace=True)\nsubmission.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2022-07-10T10:44:27.519349Z","iopub.execute_input":"2022-07-10T10:44:27.519657Z","iopub.status.idle":"2022-07-10T10:44:30.526998Z","shell.execute_reply.started":"2022-07-10T10:44:27.519623Z","shell.execute_reply":"2022-07-10T10:44:30.525874Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}