{"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":"markdown","source":"<center><h1> How To Get On The Board Notebook <h1><center>","metadata":{}},{"cell_type":"markdown","source":"---\n#### When your newer to the real competitions, sometimes it feels good to just get on the leaderboard when you start a competition. This is what we will do here...with a little flair.","metadata":{}},{"cell_type":"code","source":"## Some sweet imports\nimport pandas as pd  ## For working with data files\nimport random  ## For fun predictions","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### This competition requires predictions for each customerID so we will use the random module to generate random floating point numbers between 0 and 1.","metadata":{}},{"cell_type":"code","source":"## First read the sample submission file provided by the competition into a pandas dataframe\ndf_sample = pd.read_csv(\"../input/amex-default-prediction/sample_submission.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-05-31T04:05:43.205578Z","iopub.execute_input":"2022-05-31T04:05:43.206686Z","iopub.status.idle":"2022-05-31T04:05:44.351029Z","shell.execute_reply.started":"2022-05-31T04:05:43.206645Z","shell.execute_reply":"2022-05-31T04:05:44.349757Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"## Preview sample\ndf_sample.head()","metadata":{"execution":{"iopub.status.busy":"2022-05-31T04:10:46.83466Z","iopub.execute_input":"2022-05-31T04:10:46.835019Z","iopub.status.idle":"2022-05-31T04:10:46.844124Z","shell.execute_reply.started":"2022-05-31T04:10:46.834989Z","shell.execute_reply":"2022-05-31T04:10:46.843244Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### Well that is what they expect our submission file to look like, only the predictions column will be population with probabilities. So let's make some probabilities.","metadata":{}},{"cell_type":"code","source":"## Create a list to store our probabilities\nprediction = []\n\n## For the amount of customerID rows, call the random() function and add it's output to our prediction list:\nfor yhat in range(len(df_sample)):\n    prediction.append(random.random())\n\n## Preview our prediction list\nprediction[:5]","metadata":{"execution":{"iopub.status.busy":"2022-05-31T04:10:48.467953Z","iopub.execute_input":"2022-05-31T04:10:48.468605Z","iopub.status.idle":"2022-05-31T04:10:48.674533Z","shell.execute_reply.started":"2022-05-31T04:10:48.468559Z","shell.execute_reply":"2022-05-31T04:10:48.67362Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### Ok looks like a list full of random probabilities we got from cracker jack boxes. The only thing left to do is replace our prediction column in our sample dataframe with our new prediction list.","metadata":{}},{"cell_type":"code","source":"df_sample['prediction']=prediction\n\n## Make sure it worked\ndf_sample.head()","metadata":{"execution":{"iopub.status.busy":"2022-05-31T04:14:09.416955Z","iopub.execute_input":"2022-05-31T04:14:09.417331Z","iopub.status.idle":"2022-05-31T04:14:09.522679Z","shell.execute_reply.started":"2022-05-31T04:14:09.417302Z","shell.execute_reply":"2022-05-31T04:14:09.52172Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"## Now let's save it to the proper submission.csv file. It is important to set index parameter to \"False\",\n## otherwise our row index would be included in the output file. I would't recommend it.\ndf_sample.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2022-05-31T04:15:26.707177Z","iopub.execute_input":"2022-05-31T04:15:26.708014Z","iopub.status.idle":"2022-05-31T04:15:29.793028Z","shell.execute_reply.started":"2022-05-31T04:15:26.707974Z","shell.execute_reply":"2022-05-31T04:15:29.792221Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### Well that was fun! If your anything like me it makes it real when your on the leaderboard. Only thing left is to hit submit to your bottom right. Good luck out there!","metadata":{}},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}