def create_regional_boxplot(self): '''Produces a boxplot for each region for a certain year''' income_for_year = r.merge_by_year(self.year, self.data) by_region = [] for i in range(0, len(self.regions)): by_region.append(list(income_for_year[income_for_year['Region'] == self.regions[i]]['Income'].dropna().values)) plt.figure(figsize = (10,6)) boxplot = plt.boxplot(by_region, labels = self.regions) plt.savefig('boxplot_' + str(self.year), format = 'png') return boxplot
def create_regional_boxplot(self): '''Produces a boxplot for each region for a certain year''' income_for_year = r.merge_by_year(self.year, self.data) by_region = [] for i in range(0, len(self.regions)): by_region.append( list(income_for_year[income_for_year['Region'] == self. regions[i]]['Income'].dropna().values)) plt.figure(figsize=(10, 6)) boxplot = plt.boxplot(by_region, labels=self.regions) plt.savefig('boxplot_' + str(self.year), format='png') return boxplot
def setUp(self): self.test_merged = r.merge_by_year(2005, l.income)