from auxilary_functions import * while True: year_str = input( 'Enter a year between 1800 to 2012 to see the graph. Close the plot window before entering the next year: ' ) if year_str.lower() == 'finish': print('Goodbye!') break else: if year_str.isdigit( ): #Check if the entered value is a positive integer year_int = int(year_str) if year_int > 2012 or year_int < 1800: #Check if data is available for the entered year print('No data for this year. Please enter a valid year.') else: visualize_income_year(year_int) #plt.show() else: print('The value entered was not a year. Please enter a year!') years = list(range(2007, 2013)) #years given in the instruction for item in years: '''Create the box plots in individual files''' small_data = merge_by_year(item) explore(small_data, item).box() explore(small_data, item).histo()
from explore import * from auxilary_functions import * while True: year_str = input('Enter a year between 1800 to 2012 to see the graph. Close the plot window before entering the next year: ') if year_str.lower() == 'finish': print('Goodbye!') break else: if year_str.isdigit(): #Check if the entered value is a positive integer year_int = int(year_str) if year_int > 2012 or year_int < 1800: #Check if data is available for the entered year print('No data for this year. Please enter a valid year.') else: visualize_income_year(year_int) #plt.show() else: print('The value entered was not a year. Please enter a year!') years = list(range(2007,2013)) #years given in the instruction for item in years: '''Create the box plots in individual files''' small_data = merge_by_year(item) explore(small_data, item).box() explore(small_data,item).histo()
print(income.head()) while terminate == False: user_input = input('Please choose a year you want to see in between 1800 and 2012: \n') if user_input == 'finish': print('Thank you for using this program, your plots will be ready soon!') terminate = True break else: try: user_input.isdigit() len(user_input) == 4 year = int(user_input) except ValueError: print('Invalid input, please choose a year in 4 digit format ') income_by_year(year) ''' Generate plots for income per capita by region from year 2007 to 2013 ''' for year in range(2007, 2013): year_to_explore = explore(year) year_to_explore.draw_boxplot() year_to_explore.draw_histogram()