From the course: Data Analysis with Python and Pandas
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
Solution: Subplots
From the course: Data Analysis with Python and Pandas
Solution: Subplots
- [Instructor] Alright, everybody. Our solution code is up on the right. Let's go ahead and dive into the notebook. Alright, the first thing that we needed to do was read in our transactions table. Hopefully, you were able to find this path somewhere else in the notebook. But just remember, these two dots will push us one folder outside of our current file path. This will then push us into the retail folder, and then we'll access our "transactions.csv". And so, there were a couple ways we could do this. So I first created a transactions DataFrame and then we're going to create a "stores_1234" DataFrame. And we're going to use our lock accessor to filter to "stores_1234" using our ".isin" operator. We then create a ".pivot_table" with our "index="date"" and our columns of "store_nbr". And then we're dropping our second column level axis. We could also chain this here. So as opposed to creating a separate DataFrame for transactions, we could also consider something like this. So we're…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
The Matplotlib API and the plot() method9m 33s
-
(Locked)
Challenge: Basic line chart49s
-
(Locked)
Solution: Basic line chart3m 1s
-
(Locked)
Chart titles3m 26s
-
(Locked)
Chart colors5m 13s
-
(Locked)
Line styles2m 1s
-
(Locked)
Chart legends and gridlines3m 51s
-
(Locked)
Chart styles4m 8s
-
(Locked)
Challenge: Stylized line chart1m 11s
-
(Locked)
Solution: Stylized line chart1m 21s
-
(Locked)
Subplots and figure size5m 28s
-
(Locked)
Challenge: Subplots1m 33s
-
(Locked)
Solution: Subplots2m 59s
-
(Locked)
Bar charts6m 13s
-
(Locked)
Grouped and stacked bar charts5m 9s
-
(Locked)
Challenge: Bar charts1m 11s
-
(Locked)
Solution: Bar charts2m 19s
-
(Locked)
Pie charts and scatterplots6m 52s
-
(Locked)
Challenge: Scatterplots1m
-
(Locked)
Solution: Scatterplots2m 10s
-
(Locked)
Histograms3m 46s
-
(Locked)
Challenge: Histograms33s
-
(Locked)
Solution: Histograms1m 18s
-
(Locked)
Saving plots and further exploration3m 41s
-
(Locked)
Key takeaways2m 12s
-
(Locked)
-
-
-
-
-