{"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 pandas as pd\nimport json\nfrom pandas import json_normalize","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-02-20T03:18:50.250608Z","iopub.execute_input":"2022-02-20T03:18:50.250853Z","iopub.status.idle":"2022-02-20T03:18:50.254434Z","shell.execute_reply.started":"2022-02-20T03:18:50.250826Z","shell.execute_reply":"2022-02-20T03:18:50.253852Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"SCORED_BIRDS_JSON = \"../input/birdclef-2022/scored_birds.json\"","metadata":{"execution":{"iopub.status.busy":"2022-02-20T03:18:50.275632Z","iopub.execute_input":"2022-02-20T03:18:50.276034Z","iopub.status.idle":"2022-02-20T03:18:50.278834Z","shell.execute_reply.started":"2022-02-20T03:18:50.276003Z","shell.execute_reply":"2022-02-20T03:18:50.278410Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 1.read original json data","metadata":{}},{"cell_type":"code","source":"with open(SCORED_BIRDS_JSON) as json_file:\n    scored_json = json.load(json_file)\n    \nscored_json","metadata":{"execution":{"iopub.status.busy":"2022-02-20T03:18:50.300418Z","iopub.execute_input":"2022-02-20T03:18:50.300756Z","iopub.status.idle":"2022-02-20T03:18:50.307347Z","shell.execute_reply.started":"2022-02-20T03:18:50.300728Z","shell.execute_reply":"2022-02-20T03:18:50.306357Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# 2.read json data as pandas DataFrame","metadata":{}},{"cell_type":"code","source":"scored_birds_df = pd.read_json(SCORED_BIRDS_JSON)\n\nscored_df = pd.DataFrame()\nscored_df[\"bird_type\"] = scored_birds_df[0]\nscored_df","metadata":{"execution":{"iopub.status.busy":"2022-02-20T03:24:05.886582Z","iopub.execute_input":"2022-02-20T03:24:05.887321Z","iopub.status.idle":"2022-02-20T03:24:05.904048Z","shell.execute_reply.started":"2022-02-20T03:24:05.887285Z","shell.execute_reply":"2022-02-20T03:24:05.903484Z"},"trusted":true},"execution_count":null,"outputs":[]}]}