just reading through your code - one more suggestion. In general, when you are comparing with None, it's considered more "Pythonic" to use: `year is not None` or `year is None`.  This is especially important in pandas, because using `df != None` is very different than `df is not None` for a DataFrame.