{"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":88875,"databundleVersionId":10214941,"sourceType":"competition"}],"dockerImageVersionId":30786,"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-11-21T13:08:12.703252Z","iopub.execute_input":"2024-11-21T13:08:12.703752Z","iopub.status.idle":"2024-11-21T13:08:12.711369Z","shell.execute_reply.started":"2024-11-21T13:08:12.703714Z","shell.execute_reply":"2024-11-21T13:08:12.710125Z"}},"outputs":[],"execution_count":null},{"cell_type":"markdown","source":"**Loading the data**","metadata":{}},{"cell_type":"code","source":"# File paths\ntrain_data_path = \"/kaggle/input/datacation-hackathon/train_data.csv\"\ntest_data_path = \"/kaggle/input/datacation-hackathon/test_data.csv\"\nmembers_path = \"/kaggle/input/datacation-hackathon/members.csv\"\nuser_logs_path = \"/kaggle/input/datacation-hackathon/user_logs.csv\"\ntransactions_path = \"/kaggle/input/datacation-hackathon/transactions.csv\"\n\n# Load the data files\ndf_train = pd.read_csv(train_data_path)\ndf_test = pd.read_csv(test_data_path)\ndf_members = pd.read_csv(members_path, dtype={'gender': str})\ndf_user_logs = pd.read_csv(user_logs_path)\ndf_transactions = pd.read_csv(transactions_path)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-21T13:08:14.511099Z","iopub.execute_input":"2024-11-21T13:08:14.511475Z","iopub.status.idle":"2024-11-21T13:09:23.060325Z","shell.execute_reply.started":"2024-11-21T13:08:14.511439Z","shell.execute_reply":"2024-11-21T13:09:23.059100Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_train.head(5)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-21T13:09:23.062221Z","iopub.execute_input":"2024-11-21T13:09:23.062564Z","iopub.status.idle":"2024-11-21T13:09:23.082333Z","shell.execute_reply.started":"2024-11-21T13:09:23.062529Z","shell.execute_reply":"2024-11-21T13:09:23.081129Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_members.head(5)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-21T13:09:23.083662Z","iopub.execute_input":"2024-11-21T13:09:23.084152Z","iopub.status.idle":"2024-11-21T13:09:23.095788Z","shell.execute_reply.started":"2024-11-21T13:09:23.084075Z","shell.execute_reply":"2024-11-21T13:09:23.094678Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_test['is_churn'] = np.random.choice([0, 1], size=len(df_test), p=[0.85, 0.15])","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-21T13:09:23.097742Z","iopub.execute_input":"2024-11-21T13:09:23.098210Z","iopub.status.idle":"2024-11-21T13:09:23.112365Z","shell.execute_reply.started":"2024-11-21T13:09:23.098176Z","shell.execute_reply":"2024-11-21T13:09:23.111195Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"df_test.head(5)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2024-11-21T13:09:23.113387Z","iopub.execute_input":"2024-11-21T13:09:23.113811Z","iopub.status.idle":"2024-11-21T13:09:23.126394Z","shell.execute_reply.started":"2024-11-21T13:09:23.113778Z","shell.execute_reply":"2024-11-21T13:09:23.125182Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"# don't forget to use index=False\ndf_test.to_csv('submission.csv', index=False)","metadata":{"trusted":true},"outputs":[],"execution_count":null}]}