#100DaysOfCode in Python Transcripts
Chapter: Days 58-60: Twitter data analysis with Python
Lecture: Concepts: what did we learn
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
Lets quickly summarize what we've learned so far you can use Tweepy to interface with the Twitter API
0:08
always load API keys and secrets from your environment and a way to do that is to use the os.environ. Here's how you make a Tweepy API object, then
0:20
we can use that object to get our way to cursor till you see we get all the tweets from your timeline, then we did a top ten of most popular tweets.
0:30
First we looked over all the tweets and used sorted to get a written line down to get the most popular tweets as defined by
0:39
an average of total likes and retweets per tweet and voila. I guess some marketing folks out there will be interesting to know which tweets
0:48
are doing well, well you can and it's only a few lines of code. Next is most used hashtags and mentions. What are we talking about the most,
0:58
so we define a couple of regular expressions and put all the tweets in a big string then we use find all in combination with calender
1:06
and we saw that before in the collections and regex lessons. To get to most common hashtags, which were these, and similarly to get
1:16
the most mentioned Twitter handles, which were those, very useful info. Lastly, we made a Wordcloud of all the tweets
1:24
and we used the wordcloud module, we define the mask which was our pilots logo, added some stump words to get a better result
1:34
and constructed the word cloud object. To get the Wordcloud to show in the notebook we used a little bit of matte lot lip
1:43
and look at that, we got a word cloud in the shape PyBites logo. How cool is that right? I mean visually its beautiful but
1:56
its also informative in that we really see some words standing out. Alright, with these practical examples under your belt now its your turn
2:05
to go through, the practical exercises we have lined up for you in Day 2 and 3. Good luck.