{"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 numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:08:29.519372Z","iopub.execute_input":"2022-07-15T09:08:29.520110Z","iopub.status.idle":"2022-07-15T09:08:29.529932Z","shell.execute_reply.started":"2022-07-15T09:08:29.520057Z","shell.execute_reply":"2022-07-15T09:08:29.528403Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\nimport datetime # ...","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:08:34.906583Z","iopub.execute_input":"2022-07-15T09:08:34.907226Z","iopub.status.idle":"2022-07-15T09:08:34.915026Z","shell.execute_reply.started":"2022-07-15T09:08:34.907195Z","shell.execute_reply":"2022-07-15T09:08:34.913683Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\n# Notebook Configuration...\n\n# Amount of data we want to load into the Model...\nDATA_ROWS = None\n# Dataframe, the amount of rows and cols to visualize...\nNROWS = 50\nNCOLS = 15\n# Main data location path...\nBASE_PATH = '...'","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:08:38.887310Z","iopub.execute_input":"2022-07-15T09:08:38.887722Z","iopub.status.idle":"2022-07-15T09:08:38.894951Z","shell.execute_reply.started":"2022-07-15T09:08:38.887691Z","shell.execute_reply":"2022-07-15T09:08:38.893759Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\n# Configure notebook display settings to only use 2 decimal places, tables look nicer.\npd.options.display.float_format = '{:,.5f}'.format\npd.set_option('display.max_columns', NCOLS) \npd.set_option('display.max_rows', NROWS)","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:08:42.923658Z","iopub.execute_input":"2022-07-15T09:08:42.924070Z","iopub.status.idle":"2022-07-15T09:08:42.930231Z","shell.execute_reply.started":"2022-07-15T09:08:42.924038Z","shell.execute_reply":"2022-07-15T09:08:42.929464Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\n# Load the CSV information into a Pandas DataFrame...\ntrn_data = pd.read_feather('../input/parquet-files-amexdefault-prediction/train_data.ftr')\ntrn_lbls = pd.read_csv('/kaggle/input/amex-default-prediction/train_labels.csv').set_index('customer_ID')\n\ntst_data = pd.read_feather('../input/parquet-files-amexdefault-prediction/test_data.ftr')","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:08:46.479319Z","iopub.execute_input":"2022-07-15T09:08:46.479687Z","iopub.status.idle":"2022-07-15T09:09:50.749369Z","shell.execute_reply.started":"2022-07-15T09:08:46.479657Z","shell.execute_reply":"2022-07-15T09:09:50.747507Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\nsub = pd.read_csv('/kaggle/input/amex-default-prediction/sample_submission.csv')","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:09:58.981734Z","iopub.execute_input":"2022-07-15T09:09:58.982373Z","iopub.status.idle":"2022-07-15T09:10:01.114598Z","shell.execute_reply.started":"2022-07-15T09:09:58.982330Z","shell.execute_reply":"2022-07-15T09:10:01.112374Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\n# Explore the shape of the DataFrame...\ntrn_data.shape","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:10:05.863764Z","iopub.execute_input":"2022-07-15T09:10:05.864197Z","iopub.status.idle":"2022-07-15T09:10:05.876355Z","shell.execute_reply.started":"2022-07-15T09:10:05.864164Z","shell.execute_reply":"2022-07-15T09:10:05.875468Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trn_data.head()\n    ","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:10:08.613656Z","iopub.execute_input":"2022-07-15T09:10:08.615150Z","iopub.status.idle":"2022-07-15T09:10:08.652105Z","shell.execute_reply.started":"2022-07-15T09:10:08.615093Z","shell.execute_reply":"2022-07-15T09:10:08.650601Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trn_data.columns","metadata":{"execution":{"iopub.status.busy":"2022-07-15T06:33:20.254762Z","iopub.execute_input":"2022-07-15T06:33:20.255170Z","iopub.status.idle":"2022-07-15T06:33:20.265169Z","shell.execute_reply.started":"2022-07-15T06:33:20.255134Z","shell.execute_reply":"2022-07-15T06:33:20.263563Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trn_data['S_2'] = pd.to_datetime(trn_data['S_2'], format='%Y-%m-%d')","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:10:19.167405Z","iopub.execute_input":"2022-07-15T09:10:19.167760Z","iopub.status.idle":"2022-07-15T09:10:20.506509Z","shell.execute_reply.started":"2022-07-15T09:10:19.167734Z","shell.execute_reply":"2022-07-15T09:10:20.505430Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import sys\n\n!\"{sys.executable}\" -m pip install -U pandas-profiling[notebook]\n!jupyter nbextension enable --py widgetsnbextension","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:10:23.430939Z","iopub.execute_input":"2022-07-15T09:10:23.431492Z","iopub.status.idle":"2022-07-15T09:10:39.437005Z","shell.execute_reply.started":"2022-07-15T09:10:23.431452Z","shell.execute_reply":"2022-07-15T09:10:39.434788Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from markupsafe import escape\nimport pandas_profiling as pp\nprofile = pp.ProfileReport(trn_data)\n","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:10:45.085911Z","iopub.execute_input":"2022-07-15T09:10:45.086363Z","iopub.status.idle":"2022-07-15T09:10:45.125989Z","shell.execute_reply.started":"2022-07-15T09:10:45.086332Z","shell.execute_reply":"2022-07-15T09:10:45.124316Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"trn_data.describe()","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:10:53.934758Z","iopub.execute_input":"2022-07-15T09:10:53.935970Z","iopub.status.idle":"2022-07-15T09:15:07.636863Z","shell.execute_reply.started":"2022-07-15T09:10:53.935911Z","shell.execute_reply":"2022-07-15T09:15:07.635784Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cols=list(trn_data.columns)\nprint(cols)","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:17:03.693564Z","iopub.execute_input":"2022-07-15T09:17:03.694146Z","iopub.status.idle":"2022-07-15T09:17:03.699909Z","shell.execute_reply.started":"2022-07-15T09:17:03.694089Z","shell.execute_reply":"2022-07-15T09:17:03.699015Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cols_numeric= list(trn_data.select_dtypes(include=np.number).columns.tolist())","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:18:45.593552Z","iopub.execute_input":"2022-07-15T09:18:45.593975Z","iopub.status.idle":"2022-07-15T09:18:47.046239Z","shell.execute_reply.started":"2022-07-15T09:18:45.593944Z","shell.execute_reply":"2022-07-15T09:18:47.044923Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cols_nonnumeric= set(cols)-set(cols_numeric)\nprint(cols_nonnumeric)","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:20:02.022783Z","iopub.execute_input":"2022-07-15T09:20:02.023792Z","iopub.status.idle":"2022-07-15T09:20:02.029388Z","shell.execute_reply.started":"2022-07-15T09:20:02.023736Z","shell.execute_reply":"2022-07-15T09:20:02.028374Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2022-07-15T09:20:40.924747Z","iopub.execute_input":"2022-07-15T09:20:40.925186Z","iopub.status.idle":"2022-07-15T09:20:40.957196Z","shell.execute_reply.started":"2022-07-15T09:20:40.925144Z","shell.execute_reply":"2022-07-15T09:20:40.955924Z"},"trusted":true},"execution_count":null,"outputs":[]}]}