tutorial: tweepy

Below, a link will open a transcript from a Jupyter tutorial session on the tweepy library (a Pythonic Twitter library). We focus on how to collect and parse new datasets for use in our research. Unlike one of the other tutorials shared on this site, this one is not instantiated live in a Jupyter notebook: Instead, it is the .html produced in Jupyter during the original tutorial itself. A receipt, in a sense.

Since the file is not live, we cannot interact with it, making it much less useful than a live Jupyter notebook. But as I tend to add copious notes to our tutorial notebooks with every step, the output offers students an annotated reference to take with them.

reading jupyter_out

The notebook transcript you’re about to see has carefully color-coded our work. While you don’t have to know what the codes mean, it may be useful to know the following:

Text inside a shaded cell is text that I have typed into Jupyter / Python.

If that text begins with a hash symbol (#), then that text is always ignored by Python, meaning that it is text written by human readers for human readers. Hints, notes, reminders, complaints, etc. Obviously, then: If the line begins without a hash symbol, then Jupyter will perform those instructions.

Text outside a shaded cell is Jupyter’s response to the previous instruction: It may be data fetched from Twitter or the product of a multiplication problem, but it is typically raw, unfiltered output. While it looks messy and unwieldy, this feature is actually what makes Jupyter such a pleasure to work with. Other environments often make it hard to get to the raw data — and you almost always need to see the raw data in order to understand why your code is (or is not) working.