Git Product home page Git Product logo

dsc-2-14-04-json-and-xml-lab-online-ds-ft-041519's Introduction

JSON and XML - Lab

Introduction

In this lab, we'll continue investigating new formats for datasets. Specifically, we'll investigate two of the most popular data formats for the web: JSON and XML including strenghts and weaknesses.

Objectives

You will be able to:

  • Effectively use the JSON module to load and parse JSON documents
  • Read and access data stored in JSON and XML
  • Compare and contrast the JSON and XML as data interchange types

XML

import xml.etree.ElementTree as ET

Create an XML tree and retrieve the root tag.

#Your code here

How many direct descendents does the root tag have?

#Answer: 1

How many different types of tags are there within the entire XML file?

# Your code here

Create a DataFrame listing the number of each type of tag.

Sort the DataFrame in descending order by the tag count. The first entry should demonstrate there are 286 row tags in the XML file.
(Your DataFrame will be a single column, so could also be thought of as a Series.)

import pandas as pd
#Your code here

JSON

Open the same dataset from json

#Your code here

What is the root data type of the json file?

### Your code here

Navigate to the 'data' key of your loaded json object. What data type is this?

#Your code here

Preview the first entry from the value returned by the 'data' key above.

#Your code here

Preview the Entry under meta -> view -> columns (the keys of three successively nested dictionaries)

Create a DataFrame from your json data

The previous two questions previewed one entry from the data object within the json file, as well as the column details associated with that data from the meta entry within the json file. Both should have 19 entries. Create a DataFrame of the data. Be sure to use the information from the meta entry to add appropriate column names to your DataFrame.

#Your code here

What's wrong with the first row of the DataFrame?

#Your code here

#Your answer here

Summary

Congratulations! You've started exploring some more complicated data structures used for the web and got to practice data munging and exploring!

dsc-2-14-04-json-and-xml-lab-online-ds-ft-041519's People

Contributors

mathymitchell avatar loredirick avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.