Login and get coding
In this bite you will learn how to process the output from a Github API call and generate a summary sales report along with a yearly one. It’s up to you to decide how to approach this bite, with the exception of having to create a Pandas DataFrame from the data.
The summary report that you will generate will look like this by default:sum mean max
2013 484247.51 40353.959167 81777.35
2014 470532.51 39211.042500 75972.56
2015 608473.83 50706.152500 97237.42
2016 733947.03 61162.252500 118447.83
I’ve provided the global variable STATS, which is a list with sum, mean, max in it. This is what controls what is included in the summary report. That being said, the
summary_report()function will include the optional stats variable, which should default to STATS.
The yearly report should be as follows, for example:2013
yearly_report()function, along with requiring the DataFrame to work from, takes a year variable which determines which year to report on. If the given year is not included in the report, a
ValueErrorshould be raised.
For example, lets say that the year
1800was passed, the error message should be:
"The year 1800 is not included in the report!"
Hopefully you will learn something new from this one. Go forth and dominate!