Example #1
0
 def test_datamerger(self):                          #test the merger function to ensure the correct column headers are created
     income, countries = dataimporter()
     transformedvalues = datatransformer(income)
     year = 2000
     mergeddata = datamerger(transformedvalues, countries, year)
     mergedcolumnheaders = list(mergeddata.columns.values)
     self.assertEquals(mergedcolumnheaders,['Country', 'Region', 'Income'])
Example #2
0
                break
            elif year == 'quit':
                sys.exit()
            elif re.match(r'^[0-9]{4}$', year):
                year = int(year)
                try:
                    if year >= 1800 and year <= 2012:
                        sortedtlistForGivenYear = datasorter(transformedincome, year)
                        histogrambuilder(sortedtlistForGivenYear, year)
                except KeyError:
                    print '\n Invalid Year'
            else:
                print "\n Invalid Year."
        yearsToGeneratePlots = [2007,2008,2009,2010,2011,2012]
        for i in yearsToGeneratePlots:
            yearlyplot = visualizationtool(i)
            mergeddata = datamerger(transformedincome, countries, i)
            yearlyplot.regionshistogram(mergeddata)
            yearlyplot.boxploter(mergeddata)
        print "\n Plots have been saved. "
    except KeyboardInterrupt, ValueError:
        print "\n Interrupted!"
    except EOFError:
        print "\n Interrupted!"
    except ZeroDivisionError:
        print "\n Math Error"
    except TypeError:
        print "\n Type Wrong!"
    except OverflowError:
        print "\n OverflowError!"