{"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)\nimport mlb\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":"2021-06-19T08:35:01.390251Z","iopub.execute_input":"2021-06-19T08:35:01.390692Z","iopub.status.idle":"2021-06-19T08:35:01.427526Z","shell.execute_reply.started":"2021-06-19T08:35:01.390607Z","shell.execute_reply":"2021-06-19T08:35:01.426402Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"env = mlb.make_env()\niter_test = env.iter_test()","metadata":{"execution":{"iopub.status.busy":"2021-06-19T08:35:01.429253Z","iopub.execute_input":"2021-06-19T08:35:01.429578Z","iopub.status.idle":"2021-06-19T08:35:01.434925Z","shell.execute_reply.started":"2021-06-19T08:35:01.429547Z","shell.execute_reply":"2021-06-19T08:35:01.433576Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Until the end\n\nfor (test_df, sample_prediction_df) in iter_test:\n    \n        # Example: unpack a dataframe from a json column\n        #today_games = unpack_json(test_df['games'].iloc[0])\n    \n        # Make your predictions for the next day's engagement\n        sample_prediction_df[\"target1\"] = 0.26764763\n        sample_prediction_df[\"target2\"] = 0.4\n        sample_prediction_df[\"target3\"] = 0.5\n        sample_prediction_df[\"target4\"] = 0.9\n    \n        # Submit your predictions \n        env.predict(sample_prediction_df)","metadata":{"execution":{"iopub.status.busy":"2021-06-19T08:35:01.436572Z","iopub.execute_input":"2021-06-19T08:35:01.437039Z","iopub.status.idle":"2021-06-19T08:35:03.130649Z","shell.execute_reply.started":"2021-06-19T08:35:01.437006Z","shell.execute_reply":"2021-06-19T08:35:03.129657Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(sample_prediction_df.dtypes)\nsample_prediction_df.head()\n","metadata":{"execution":{"iopub.status.busy":"2021-06-19T08:35:03.132454Z","iopub.execute_input":"2021-06-19T08:35:03.132747Z","iopub.status.idle":"2021-06-19T08:35:03.159233Z","shell.execute_reply.started":"2021-06-19T08:35:03.132720Z","shell.execute_reply":"2021-06-19T08:35:03.158323Z"},"trusted":true},"execution_count":null,"outputs":[]}]}