From 2fca1701a335f600187615e99483f0f881ebe9c6 Mon Sep 17 00:00:00 2001 From: Hobson Lane Date: Wed, 15 Aug 2018 13:14:32 -0700 Subject: [PATCH 1/2] Created using Colaboratory --- JSON exercise LM.ipynb | 379 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 379 insertions(+) create mode 100644 JSON exercise LM.ipynb diff --git a/JSON exercise LM.ipynb b/JSON exercise LM.ipynb new file mode 100644 index 00000000..7d104c3f --- /dev/null +++ b/JSON exercise LM.ipynb @@ -0,0 +1,379 @@ +{ + "nbformat": 4, + "nbformat_minor": 0, + "metadata": { + "colab": { + "name": "JSON exercise LM.ipynb", + "version": "0.3.2", + "provenance": [], + "include_colab_link": true + }, + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + } + }, + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "[View in Colaboratory](https://colab.research.google.com/github/hobson/example-python/blob/master/JSON%20exercise%20LM.ipynb)" + ] + }, + { + "metadata": { + "id": "AolWd5kWID0X", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "import pandas as pd" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "22JJQiQVID0x", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "import json\n", + "from pandas.io.json import json_normalize" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "XrQ_WvaQID09", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "data = [{ \"_id\" : { \"$oid\" : \"52b213b38594d8a2be17c780\" },\n", + " \"boardapprovaldate\" : \"2013-11-12T00:00:00Z\", \n", + " \"borrower\" : {\"FEDERAL DEMOCRATIC REPUBLIC OF ETHIOPIA\"},\n", + " \"closingdate\" : {\"2018-07-07T00:00:00Z\"}, \n", + " \"country_namecode\" : {\"Federal Democratic Republic of Ethiopia!$!ET\"},\n", + " \"countrycode\" : {\"ET\"}, \n", + " \"countryname\" : {\"Federal Democratic Republic of Ethiopia\"}, \n", + " \"countryshortname\" : {\"Ethiopia\"}, \n", + " \"docty\" : {\"Project Information Document,Indigenous Peoples Plan,Project Information Document\"},\n", + "\"impagency\" : {\"MINISTRY OF EDUCATION\"}, \n", + "\"lendinginstr\" : {\"Investment Project Financing\"}, \n", + "\"lendinginstrtype\" : {\"IN\"}, \n", + "\"lendprojectcost\" : {550000000}, \n", + "\"majorsector_percent\" :\n", + " [ { \"Name\" : \"Education\", \"Percent\" : 46 }, \n", + " { \"Name\" : \"Education\", \"Percent\" : 26 }, \n", + " { \"Name\" : \"Public Administration, Law, and Justice\",\"Percent\" : 16 },\n", + " { \"Name\" : \"Education\", \"Percent\" : 12 } ]}]" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "XtLW2ws7ID1M", + "colab_type": "code", + "colab": {}, + "outputId": "1707ecf0-46ae-4a3d-fa0b-bff5bec1909f" + }, + "cell_type": "code", + "source": [ + "json_normalize(data, ['_id', ['boardapprovaldate'], 'borrower', 'closingdate', 'country_namecode', 'countrycode', 'countryname', 'countryshortname', 'docty', 'impagency', 'lendinginstr', 'lendinginstrtype', 'lendprojectcost', 'majorsector_percent', ['Name', 'Education', 'Percent']])" + ], + "execution_count": 0, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "string indices must be integers", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mjson_normalize\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;34m'_id'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;34m'boardapprovaldate'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'borrower'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'closingdate'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'country_namecode'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'countrycode'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'countryname'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'countryshortname'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'docty'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'impagency'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'lendinginstr'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'lendinginstrtype'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'lendprojectcost'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'majorsector_percent'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;34m'Name'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'Education'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'Percent'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[1;32m~\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\pandas\\io\\json\\normalize.py\u001b[0m in \u001b[0;36mjson_normalize\u001b[1;34m(data, record_path, meta, meta_prefix, record_prefix, errors, sep)\u001b[0m\n\u001b[0;32m 260\u001b[0m \u001b[0mrecords\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mextend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrecs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 261\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 262\u001b[1;33m \u001b[0m_recursive_extract\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mrecord_path\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m{\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 263\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 264\u001b[0m \u001b[0mresult\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mDataFrame\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrecords\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32m~\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\pandas\\io\\json\\normalize.py\u001b[0m in \u001b[0;36m_recursive_extract\u001b[1;34m(data, path, seen_meta, level)\u001b[0m\n\u001b[0;32m 233\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 234\u001b[0m _recursive_extract(obj[path[0]], path[1:],\n\u001b[1;32m--> 235\u001b[1;33m seen_meta, level=level + 1)\n\u001b[0m\u001b[0;32m 236\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 237\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mobj\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mdata\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32m~\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\pandas\\io\\json\\normalize.py\u001b[0m in \u001b[0;36m_recursive_extract\u001b[1;34m(data, path, seen_meta, level)\u001b[0m\n\u001b[0;32m 232\u001b[0m \u001b[0mseen_meta\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0m_pull_field\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mobj\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mval\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 233\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 234\u001b[1;33m _recursive_extract(obj[path[0]], path[1:],\n\u001b[0m\u001b[0;32m 235\u001b[0m seen_meta, level=level + 1)\n\u001b[0;32m 236\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mTypeError\u001b[0m: string indices must be integers" + ] + } + ] + }, + { + "metadata": { + "id": "0wJUolOJMHg_", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 206 + }, + "outputId": "bcd970ed-f917-4ab2-84f1-8d15430bd9e6" + }, + "cell_type": "code", + "source": [ + "# it's good to step back and make sure you have the problem set up correctly and you know how they work.\n", + "# define json string\n", + "data = [{'state': 'Florida', \n", + " 'shortname': 'FL',\n", + " 'info': {'governor': 'Rick Scott'},\n", + " 'counties': [{'name': 'Dade', 'population': 12345},\n", + " {'name': 'Broward', 'population': 40000},\n", + " {'name': 'Palm Beach', 'population': 60000}]},\n", + " {'state': 'Ohio',\n", + " 'shortname': 'OH',\n", + " 'info': {'governor': 'John Kasich'},\n", + " 'counties': [{'name': 'Summit', 'population': 1234},\n", + " {'name': 'Cuyahoga', 'population': 1337}]}]\n", + "json_normalize(data, 'counties', ['state', 'shortname', ['info', 'governor']])\n", + "\n", + "# Play around with this example, modify it, see if you can break it or do something different with it!!!!" + ], + "execution_count": 9, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
namepopulationstateshortnameinfo.governor
0Dade12345FloridaFLRick Scott
1Broward40000FloridaFLRick Scott
2Palm Beach60000FloridaFLRick Scott
3Summit1234OhioOHJohn Kasich
4Cuyahoga1337OhioOHJohn Kasich
\n", + "
" + ], + "text/plain": [ + " name population state shortname info.governor\n", + "0 Dade 12345 Florida FL Rick Scott\n", + "1 Broward 40000 Florida FL Rick Scott\n", + "2 Palm Beach 60000 Florida FL Rick Scott\n", + "3 Summit 1234 Ohio OH John Kasich\n", + "4 Cuyahoga 1337 Ohio OH John Kasich" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 9 + } + ] + }, + { + "metadata": { + "id": "9E6tocdYID1e", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 81 + }, + "outputId": "8025ca7c-e09a-4147-aa68-bc1fae35dd53" + }, + "cell_type": "code", + "source": [ + "# Now let's work with your data:\n", + "data = [{ \"_id\" : { \"$oid\" : \"52b213b38594d8a2be17c780\" },\n", + " \"boardapprovaldate\" : \"2013-11-12T00:00:00Z\", \n", + " \"borrower\" : {\"FEDERAL DEMOCRATIC REPUBLIC OF ETHIOPIA\"},\n", + " \"closingdate\" : {\"2018-07-07T00:00:00Z\"}, \n", + " \"country_namecode\" : {\"Federal Democratic Republic of Ethiopia!$!ET\"},\n", + " \"countrycode\" : {\"ET\"}, \n", + " \"countryname\" : {\"Federal Democratic Republic of Ethiopia\"}, \n", + " \"countryshortname\" : {\"Ethiopia\"}, \n", + " \"docty\" : {\"Project Information Document,Indigenous Peoples Plan,Project Information Document\"},\n", + "\"impagency\" : {\"MINISTRY OF EDUCATION\"}, \n", + "\"lendinginstr\" : {\"Investment Project Financing\"}, \n", + "\"lendinginstrtype\" : {\"IN\"}, \n", + "\"lendprojectcost\" : {550000000}, \n", + "\"majorsector_percent\" :\n", + " [ { \"Name\" : \"Education\", \"Percent\" : 46 }, \n", + " { \"Name\" : \"Education\", \"Percent\" : 26 }, \n", + " { \"Name\" : \"Public Administration, Law, and Justice\",\"Percent\" : 16 },\n", + " { \"Name\" : \"Education\", \"Percent\" : 12 } ]}]\n", + "#Simplify you json normalize command and build it up one step at a time...\n", + "json_normalize(data, ['_id'])\n", + "\n", + "\n" + ], + "execution_count": 10, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
0
0$oid
\n", + "
" + ], + "text/plain": [ + " 0\n", + "0 $oid" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 10 + } + ] + }, + { + "metadata": { + "id": "sq02rF_gNjC6", + "colab_type": "code", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 651 + }, + "outputId": "2a037e2e-31bc-41c0-bd0d-1a7abbe2289e" + }, + "cell_type": "code", + "source": [ + "json_normalize(data, ['_id', ['boardapprovaldate']])" + ], + "execution_count": 11, + "outputs": [ + { + "output_type": "error", + "ename": "TypeError", + "evalue": "ignored", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mjson_normalize\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'_id'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'boardapprovaldate'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m/usr/local/lib/python3.6/dist-packages/pandas/io/json/normalize.py\u001b[0m in \u001b[0;36mjson_normalize\u001b[0;34m(data, record_path, meta, meta_prefix, record_prefix, errors, sep)\u001b[0m\n\u001b[1;32m 254\u001b[0m \u001b[0mrecords\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mextend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrecs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 255\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 256\u001b[0;31m \u001b[0m_recursive_extract\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrecord_path\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 257\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 258\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mDataFrame\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrecords\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/local/lib/python3.6/dist-packages/pandas/io/json/normalize.py\u001b[0m in \u001b[0;36m_recursive_extract\u001b[0;34m(data, path, seen_meta, level)\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 228\u001b[0m _recursive_extract(obj[path[0]], path[1:],\n\u001b[0;32m--> 229\u001b[0;31m seen_meta, level=level + 1)\n\u001b[0m\u001b[1;32m 230\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 231\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mobj\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/local/lib/python3.6/dist-packages/pandas/io/json/normalize.py\u001b[0m in \u001b[0;36m_recursive_extract\u001b[0;34m(data, path, seen_meta, level)\u001b[0m\n\u001b[1;32m 230\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 231\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mobj\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 232\u001b[0;31m \u001b[0mrecs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_pull_field\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpath\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 233\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 234\u001b[0m \u001b[0;31m# For repeating the metadata later\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/usr/local/lib/python3.6/dist-packages/pandas/io/json/normalize.py\u001b[0m in \u001b[0;36m_pull_field\u001b[0;34m(js, spec)\u001b[0m\n\u001b[1;32m 176\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mspec\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlist\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 177\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mfield\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mspec\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 178\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mfield\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 179\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 180\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mspec\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mTypeError\u001b[0m: string indices must be integers" + ] + } + ] + }, + { + "metadata": { + "id": "prspefwMN96f", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "# ^so something is wrong with the very first part of your json normalize command, fix that first !!!" + ], + "execution_count": 0, + "outputs": [] + }, + { + "metadata": { + "id": "Aw0O5p4MNfqP", + "colab_type": "code", + "colab": {} + }, + "cell_type": "code", + "source": [ + "json.load((open('C:\\Users\\lmontoni\\OneDrive - Mission1st\\Desktop\\data_wrangling_json\\world_bank_projects.json')))" + ], + "execution_count": 0, + "outputs": [] + } + ] +} \ No newline at end of file From 5b0c19719a725dbf0c137f3e657ce715e27e7ad8 Mon Sep 17 00:00:00 2001 From: Hobson Lane Date: Wed, 15 Aug 2018 13:15:59 -0700 Subject: [PATCH 2/2] Delete JSON exercise LM.ipynb --- JSON exercise LM.ipynb | 379 ----------------------------------------- 1 file changed, 379 deletions(-) delete mode 100644 JSON exercise LM.ipynb diff --git a/JSON exercise LM.ipynb b/JSON exercise LM.ipynb deleted file mode 100644 index 7d104c3f..00000000 --- a/JSON exercise LM.ipynb +++ /dev/null @@ -1,379 +0,0 @@ -{ - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "name": "JSON exercise LM.ipynb", - "version": "0.3.2", - "provenance": [], - "include_colab_link": true - }, - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - } - }, - "cells": [ - { - "cell_type": "markdown", - "metadata": { - "id": "view-in-github", - "colab_type": "text" - }, - "source": [ - "[View in Colaboratory](https://colab.research.google.com/github/hobson/example-python/blob/master/JSON%20exercise%20LM.ipynb)" - ] - }, - { - "metadata": { - "id": "AolWd5kWID0X", - "colab_type": "code", - "colab": {} - }, - "cell_type": "code", - "source": [ - "import pandas as pd" - ], - "execution_count": 0, - "outputs": [] - }, - { - "metadata": { - "id": "22JJQiQVID0x", - "colab_type": "code", - "colab": {} - }, - "cell_type": "code", - "source": [ - "import json\n", - "from pandas.io.json import json_normalize" - ], - "execution_count": 0, - "outputs": [] - }, - { - "metadata": { - "id": "XrQ_WvaQID09", - "colab_type": "code", - "colab": {} - }, - "cell_type": "code", - "source": [ - "data = [{ \"_id\" : { \"$oid\" : \"52b213b38594d8a2be17c780\" },\n", - " \"boardapprovaldate\" : \"2013-11-12T00:00:00Z\", \n", - " \"borrower\" : {\"FEDERAL DEMOCRATIC REPUBLIC OF ETHIOPIA\"},\n", - " \"closingdate\" : {\"2018-07-07T00:00:00Z\"}, \n", - " \"country_namecode\" : {\"Federal Democratic Republic of Ethiopia!$!ET\"},\n", - " \"countrycode\" : {\"ET\"}, \n", - " \"countryname\" : {\"Federal Democratic Republic of Ethiopia\"}, \n", - " \"countryshortname\" : {\"Ethiopia\"}, \n", - " \"docty\" : {\"Project Information Document,Indigenous Peoples Plan,Project Information Document\"},\n", - "\"impagency\" : {\"MINISTRY OF EDUCATION\"}, \n", - "\"lendinginstr\" : {\"Investment Project Financing\"}, \n", - "\"lendinginstrtype\" : {\"IN\"}, \n", - "\"lendprojectcost\" : {550000000}, \n", - "\"majorsector_percent\" :\n", - " [ { \"Name\" : \"Education\", \"Percent\" : 46 }, \n", - " { \"Name\" : \"Education\", \"Percent\" : 26 }, \n", - " { \"Name\" : \"Public Administration, Law, and Justice\",\"Percent\" : 16 },\n", - " { \"Name\" : \"Education\", \"Percent\" : 12 } ]}]" - ], - "execution_count": 0, - "outputs": [] - }, - { - "metadata": { - "id": "XtLW2ws7ID1M", - "colab_type": "code", - "colab": {}, - "outputId": "1707ecf0-46ae-4a3d-fa0b-bff5bec1909f" - }, - "cell_type": "code", - "source": [ - "json_normalize(data, ['_id', ['boardapprovaldate'], 'borrower', 'closingdate', 'country_namecode', 'countrycode', 'countryname', 'countryshortname', 'docty', 'impagency', 'lendinginstr', 'lendinginstrtype', 'lendprojectcost', 'majorsector_percent', ['Name', 'Education', 'Percent']])" - ], - "execution_count": 0, - "outputs": [ - { - "output_type": "error", - "ename": "TypeError", - "evalue": "string indices must be integers", - "traceback": [ - "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mjson_normalize\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;34m'_id'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;34m'boardapprovaldate'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'borrower'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'closingdate'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'country_namecode'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'countrycode'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'countryname'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'countryshortname'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'docty'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'impagency'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'lendinginstr'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'lendinginstrtype'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'lendprojectcost'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'majorsector_percent'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m[\u001b[0m\u001b[1;34m'Name'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'Education'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'Percent'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[1;32m~\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\pandas\\io\\json\\normalize.py\u001b[0m in \u001b[0;36mjson_normalize\u001b[1;34m(data, record_path, meta, meta_prefix, record_prefix, errors, sep)\u001b[0m\n\u001b[0;32m 260\u001b[0m \u001b[0mrecords\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mextend\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrecs\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 261\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 262\u001b[1;33m \u001b[0m_recursive_extract\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mrecord_path\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m{\u001b[0m\u001b[1;33m}\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 263\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 264\u001b[0m \u001b[0mresult\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mDataFrame\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mrecords\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;32m~\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\pandas\\io\\json\\normalize.py\u001b[0m in \u001b[0;36m_recursive_extract\u001b[1;34m(data, path, seen_meta, level)\u001b[0m\n\u001b[0;32m 233\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 234\u001b[0m _recursive_extract(obj[path[0]], path[1:],\n\u001b[1;32m--> 235\u001b[1;33m seen_meta, level=level + 1)\n\u001b[0m\u001b[0;32m 236\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 237\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mobj\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mdata\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;32m~\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\pandas\\io\\json\\normalize.py\u001b[0m in \u001b[0;36m_recursive_extract\u001b[1;34m(data, path, seen_meta, level)\u001b[0m\n\u001b[0;32m 232\u001b[0m \u001b[0mseen_meta\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mkey\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0m_pull_field\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mobj\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mval\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m-\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 233\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 234\u001b[1;33m _recursive_extract(obj[path[0]], path[1:],\n\u001b[0m\u001b[0;32m 235\u001b[0m seen_meta, level=level + 1)\n\u001b[0;32m 236\u001b[0m \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", - "\u001b[1;31mTypeError\u001b[0m: string indices must be integers" - ] - } - ] - }, - { - "metadata": { - "id": "0wJUolOJMHg_", - "colab_type": "code", - "colab": { - "base_uri": "https://localhost:8080/", - "height": 206 - }, - "outputId": "bcd970ed-f917-4ab2-84f1-8d15430bd9e6" - }, - "cell_type": "code", - "source": [ - "# it's good to step back and make sure you have the problem set up correctly and you know how they work.\n", - "# define json string\n", - "data = [{'state': 'Florida', \n", - " 'shortname': 'FL',\n", - " 'info': {'governor': 'Rick Scott'},\n", - " 'counties': [{'name': 'Dade', 'population': 12345},\n", - " {'name': 'Broward', 'population': 40000},\n", - " {'name': 'Palm Beach', 'population': 60000}]},\n", - " {'state': 'Ohio',\n", - " 'shortname': 'OH',\n", - " 'info': {'governor': 'John Kasich'},\n", - " 'counties': [{'name': 'Summit', 'population': 1234},\n", - " {'name': 'Cuyahoga', 'population': 1337}]}]\n", - "json_normalize(data, 'counties', ['state', 'shortname', ['info', 'governor']])\n", - "\n", - "# Play around with this example, modify it, see if you can break it or do something different with it!!!!" - ], - "execution_count": 9, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
namepopulationstateshortnameinfo.governor
0Dade12345FloridaFLRick Scott
1Broward40000FloridaFLRick Scott
2Palm Beach60000FloridaFLRick Scott
3Summit1234OhioOHJohn Kasich
4Cuyahoga1337OhioOHJohn Kasich
\n", - "
" - ], - "text/plain": [ - " name population state shortname info.governor\n", - "0 Dade 12345 Florida FL Rick Scott\n", - "1 Broward 40000 Florida FL Rick Scott\n", - "2 Palm Beach 60000 Florida FL Rick Scott\n", - "3 Summit 1234 Ohio OH John Kasich\n", - "4 Cuyahoga 1337 Ohio OH John Kasich" - ] - }, - "metadata": { - "tags": [] - }, - "execution_count": 9 - } - ] - }, - { - "metadata": { - "id": "9E6tocdYID1e", - "colab_type": "code", - "colab": { - "base_uri": "https://localhost:8080/", - "height": 81 - }, - "outputId": "8025ca7c-e09a-4147-aa68-bc1fae35dd53" - }, - "cell_type": "code", - "source": [ - "# Now let's work with your data:\n", - "data = [{ \"_id\" : { \"$oid\" : \"52b213b38594d8a2be17c780\" },\n", - " \"boardapprovaldate\" : \"2013-11-12T00:00:00Z\", \n", - " \"borrower\" : {\"FEDERAL DEMOCRATIC REPUBLIC OF ETHIOPIA\"},\n", - " \"closingdate\" : {\"2018-07-07T00:00:00Z\"}, \n", - " \"country_namecode\" : {\"Federal Democratic Republic of Ethiopia!$!ET\"},\n", - " \"countrycode\" : {\"ET\"}, \n", - " \"countryname\" : {\"Federal Democratic Republic of Ethiopia\"}, \n", - " \"countryshortname\" : {\"Ethiopia\"}, \n", - " \"docty\" : {\"Project Information Document,Indigenous Peoples Plan,Project Information Document\"},\n", - "\"impagency\" : {\"MINISTRY OF EDUCATION\"}, \n", - "\"lendinginstr\" : {\"Investment Project Financing\"}, \n", - "\"lendinginstrtype\" : {\"IN\"}, \n", - "\"lendprojectcost\" : {550000000}, \n", - "\"majorsector_percent\" :\n", - " [ { \"Name\" : \"Education\", \"Percent\" : 46 }, \n", - " { \"Name\" : \"Education\", \"Percent\" : 26 }, \n", - " { \"Name\" : \"Public Administration, Law, and Justice\",\"Percent\" : 16 },\n", - " { \"Name\" : \"Education\", \"Percent\" : 12 } ]}]\n", - "#Simplify you json normalize command and build it up one step at a time...\n", - "json_normalize(data, ['_id'])\n", - "\n", - "\n" - ], - "execution_count": 10, - "outputs": [ - { - "output_type": "execute_result", - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
0
0$oid
\n", - "
" - ], - "text/plain": [ - " 0\n", - "0 $oid" - ] - }, - "metadata": { - "tags": [] - }, - "execution_count": 10 - } - ] - }, - { - "metadata": { - "id": "sq02rF_gNjC6", - "colab_type": "code", - "colab": { - "base_uri": "https://localhost:8080/", - "height": 651 - }, - "outputId": "2a037e2e-31bc-41c0-bd0d-1a7abbe2289e" - }, - "cell_type": "code", - "source": [ - "json_normalize(data, ['_id', ['boardapprovaldate']])" - ], - "execution_count": 11, - "outputs": [ - { - "output_type": "error", - "ename": "TypeError", - "evalue": "ignored", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mjson_normalize\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'_id'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;34m'boardapprovaldate'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/usr/local/lib/python3.6/dist-packages/pandas/io/json/normalize.py\u001b[0m in \u001b[0;36mjson_normalize\u001b[0;34m(data, record_path, meta, meta_prefix, record_prefix, errors, sep)\u001b[0m\n\u001b[1;32m 254\u001b[0m \u001b[0mrecords\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mextend\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrecs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 255\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 256\u001b[0;31m \u001b[0m_recursive_extract\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mrecord_path\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 257\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 258\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mDataFrame\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mrecords\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/usr/local/lib/python3.6/dist-packages/pandas/io/json/normalize.py\u001b[0m in \u001b[0;36m_recursive_extract\u001b[0;34m(data, path, seen_meta, level)\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 228\u001b[0m _recursive_extract(obj[path[0]], path[1:],\n\u001b[0;32m--> 229\u001b[0;31m seen_meta, level=level + 1)\n\u001b[0m\u001b[1;32m 230\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 231\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mobj\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/usr/local/lib/python3.6/dist-packages/pandas/io/json/normalize.py\u001b[0m in \u001b[0;36m_recursive_extract\u001b[0;34m(data, path, seen_meta, level)\u001b[0m\n\u001b[1;32m 230\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 231\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mobj\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 232\u001b[0;31m \u001b[0mrecs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_pull_field\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpath\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 233\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 234\u001b[0m \u001b[0;31m# For repeating the metadata later\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/usr/local/lib/python3.6/dist-packages/pandas/io/json/normalize.py\u001b[0m in \u001b[0;36m_pull_field\u001b[0;34m(js, spec)\u001b[0m\n\u001b[1;32m 176\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mspec\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlist\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 177\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mfield\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mspec\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 178\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mfield\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 179\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 180\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mspec\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mTypeError\u001b[0m: string indices must be integers" - ] - } - ] - }, - { - "metadata": { - "id": "prspefwMN96f", - "colab_type": "code", - "colab": {} - }, - "cell_type": "code", - "source": [ - "# ^so something is wrong with the very first part of your json normalize command, fix that first !!!" - ], - "execution_count": 0, - "outputs": [] - }, - { - "metadata": { - "id": "Aw0O5p4MNfqP", - "colab_type": "code", - "colab": {} - }, - "cell_type": "code", - "source": [ - "json.load((open('C:\\Users\\lmontoni\\OneDrive - Mission1st\\Desktop\\data_wrangling_json\\world_bank_projects.json')))" - ], - "execution_count": 0, - "outputs": [] - } - ] -} \ No newline at end of file pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy