Esempio n. 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'])
Esempio n. 2
0
import traceback
import re
import sys
import numpy as np
import pandas as pd
import dataloader
from dataloader import dataimporter, datatransformer, datasorter, datamerger
import visualizer
from visualizer import visualizationtool, histogrambuilder


if __name__ == '__main__':
    try:
        income, countries = dataimporter()
        transformedincome = datatransformer(income)
        print transformedincome.head()
        while True:
            print 'Input a year between 1800 and 2012 or enter finish to conclude the program and generat plots from 2007 to 2013.\n'
            print 'If you wish to end the program and not generate plots, enter quit.\n'
            year = raw_input('Please enter a year in the format YYYY to explore the Per Capita GDP across regions of the world\n')
            if year == 'finish':
                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)
Esempio n. 3
0
 def test_datatransformer(self):                     #test the data tranformer to confirm the shape is correct
     income, countries = dataimporter()
     transformedvalues = datatransformer(income)
     self.assertEquals(transformedvalues.shape,(213, 230))