Data Science Jumpstart with 10 Projects Transcripts
Chapter: Project 9: SQL / Database Integration
Lecture: Visualize SQLite Data using Pandas

Login or purchase this course to watch this video and the rest of the course contents.
0:00 One of the downsides of databases is they don't have visualization. And as you've seen, I'm a huge fan of visualization.
0:07 So once we pull out our data, we can visualize it with pandas relatively easily. So I'm going to select the date and TOBS, this is temperature
0:15 when someone went out and measured the snow levels. It looks something like this. Let's see if we can visualize this.
0:21 So I'm going to say, let's group by date and do it at the month frequency. And then we're going to get the mean values and we're going to plot that.
0:30 And we got an error here. And what is our error? It says you can only use grouper if you have a date time in there, but it didn't get a date time.
0:39 So let's see if we can convert date to a date time. If we do this, it says that it is an object. Sadly, that's not really what we want.
0:48 We don't want it to be an object. If we say UTC is equal to true, then it comes out as a date time.
0:55 This is one of those issues that I don't like with pandas. And that sometimes it converts things to dates.
1:02 If you look at the type of this, I'm just going to say like ILOC 0 to pull off the first date here. This is a timestamp object.
1:11 If you look at this one, this is a timestamp object in UTC. This should work. I'm going to actually convert that to Denver.
1:20 And then what I'll do is I'm going to say, now let's group that by date and let's plot that. So here's the grouping by date. Looks like that did work.
1:32 We can visualize that. Let's just zoom in from 2010 to 2012. So again, this is the temperature and you can see that it's cold during the winter.
1:41 And then it warms up in the summer, gets cold, warms up, etc. We see that cyclical pattern.
1:46 And we can't really visualize with the database unless we stick on a BI tool on it. Pandas lets us do this relatively easily.


Talk Python's Mastodon Michael Kennedy's Mastodon