#100DaysOfCode in Python Transcripts
Chapter: Days 82-84: Data visualization with Plotly
Lecture: Concepts: what did we learn

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Let's review what we've learned so far.
0:03 Adding the RSS data, you really want
0:05 to use feedparser to get the RSS data.
0:08 We pip install that as well as Plotly
0:10 to do the data visualization.
0:14 Then we imported the modules
0:16 and I used feedparser to parse the RSS feed.
0:19 Which you can see one line of code
0:21 and it wraps this in a nice data structure.
0:23 Which you can even access with a dot notation.
0:27 Then we prepare to data.
0:30 We wrote two helpers.
0:32 One to convert the date string into datetime object.
0:36 I made a little detour explaining a bit
0:38 why you would want to use datetime
0:40 when you want to calculate the dates.
0:43 But in this example, it was merely to extract year and month
0:45 to have a consistent value for our graphs.
0:49 Then we extracted the categories from the blog links
0:52 making them another helper.
0:54 Using a regular expression to extract the category.
0:56 If it's in the dictionary,
0:58 we return it, otherwise return to default set to article.
1:02 Next we converted the data so far to usable structures.
1:06 All the graphs have counting in common
1:08 and that's where counter is your best friend.
1:12 You can see we generated a big list
1:15 of all the publication dates
1:16 and we can just put them into counter
1:18 which makes this nice, frequency counter.
1:22 We prepare all three graphs.
1:24 This was the first one.
1:27 The second one were the categories
1:29 and the third one were the tags.
1:31 You can already see that this starts to
1:34 paint a picture of what our PyBites blog is about.
1:37 The final trick we needed was transposing the data,
1:41 making X and Y axis.
1:43 I used a nice trick from Raymond Hettinger to
1:47 use*data in combination with zip to make
1:51 a date-like object or a list of tuples.
1:53 Transposing the data to X and Y axis'
1:56 which made it way more easy to plot.
2:02 Then I extenuate Plotly object,
2:05 giving it the offline mode
2:06 and calling the innate notebook mode method
2:10 to make it work inside my Jupiter notebook.
2:13 Then the three plots.
2:14 Post for months frequency with all the prep
2:17 data done, a small amount of code with a nice graph.
2:20 Here you see the activity per month
2:22 and number of entries in the blog.
2:24 Secondly, the common blog categories.
2:27 We went and made a pie chart, which makes a nice visualization
2:30 what kind of categories our blog posts are.
2:33 You can see that challenging articles
2:34 trumped the other categories.
2:36 For common blog tags, it's kind of similar as categories
2:40 but it's a bit more granular.
2:42 There you can also see that we blogged quite a bit about
2:45 Flask and Django, github code automations,
2:49 but this is a way nicer way to
2:50 demonstrate it in any presentation.
2:53 Check out other libraries, Bokeh,
2:57 this is from Panda's in combination with Matplotlib,
3:00 a very powerful combination.
3:03 This is a print screen from the Seaborn library.
3:09 As mentioned before, Matplotlib is
3:11 also a very robust library
3:13 and there might be many others
3:15 but mostly I use Panda's and some Bokeh.
3:17 I decided to use Plotly for this lesson
3:20 as it's simple to use and has nice graphs.
3:23 Now it's your turn, keep calm and code in Python.