80 likes | 170 Views
Learn how to download and manage class materials in JSON format on your desktop. Understand the basics of JSON in Python, data transfer, and storage. Analyze tweet data with key attributes and geotags efficiently.
E N D
JSON(JavaScript Object Notation) • Think of it as a string representation of a Python object, in particular, a dictionary • The json package in Python allows you to convert a library to a JSON object(string representation) or from a JSON object to a Python object. • This allows easy data transfer and storage across platforms.
Answer the following questions • How many keys (attributes) are there in a single tweet? • What are they (can you print them out)? • One of the keys is 'user'. What type of object is its value? • Does a tweet have a key called 'place'? What type of object is its value?
Next tasks • I just loaded one tweet for you. Can you load all of them • Can you find out how many tweets whose 'place' attribute is not None? • For those tweets whose 'place' attributes are not None, print the values of 'place'. What type of object they are?
More about geotag • The value of 'place', when not None, is a dictionary. Find out what are its keys. • Look at 'bounding_box'. These are four coordinates that specify a square on the earth. Take the first one. Can you find out where it is?