Example #1
0
def month_analysis_main_function(data):
    """
    This function is going to use in main program, which will generate plots for monthly citibike data.
    """

    while True:
        print '\n**************************************************************'
        print '\nPart 1 Instruction:\n'
        print 'Please enter valid year and month from 2013/7 to 2015/10. Year format: 2015, Month format: 7\n'
        print 'Enter back: return to main meun.'
        print 'Enter quit: exit this program.\n'
        print '*****************************************************************\n'
        year = raw_input('Please enter a year: ')
        if year == 'quit':
            print '\nThanks, bye!'
            sys.exit()
        elif year == 'back':
            break
        month = raw_input('Please enter a month: ')
        if month == 'quit':
            print '\nThanks, bye!'
            sys.exit()
        elif month == 'back':
            break
        if gf.check(year, month):
            year_int = int(year)
            month_int = int(month)
            print 'Please wait.......'
            data_month = gf.data_extract(data, year_int, month_int, year_int, month_int)
            object_plot = vs.visualizationTool(data_month, year_int, month_int)
            print '====> Generating gender distribution pie plot...'
            object_plot.pieplot('gender')
            print '====> Generating usertype distribution pie plot...'
            object_plot.pieplot('usertype')
            print '====> Generating daily usage plot...'
            object_plot.plot_daily_freq(show_mile=False)
            print '====> Generating daily miles plot...'
            object_plot.plot_daily_freq(show_mile=True)
        else:
            print '\nError: Please enter valid year and month!\n'
    return
Example #2
0
 def test_plottingTool_2(self):      
     data_month = gf.data_extract(self.data, 2015, 3, 2015, 3)
     month_data = vs.visualizationTool(data_month, 2015, 3)
     self.assertEqual(month_data.year, 2015)
     self.assertEqual(month_data.month, 3)
Example #3
0
 def test_plottingTool_1(self):
     data_month = gf.data_extract(self.data, 2014, 1, 2014, 1)
     month_data = vs.visualizationTool(data_month, 2014, 1)
     self.assertEqual(month_data.year, 2014)
     self.assertEqual(month_data.month, 1)
Example #4
0
 def test_plottingTool_2(self):
     data_month = gf.data_extract(self.data, 2015, 3, 2015, 3)
     month_data = vs.visualizationTool(data_month, 2015, 3)
     self.assertEqual(month_data.year, 2015)
     self.assertEqual(month_data.month, 3)
Example #5
0
 def test_plottingTool_1(self):
     data_month = gf.data_extract(self.data, 2014, 1, 2014, 1)
     month_data = vs.visualizationTool(data_month, 2014, 1)
     self.assertEqual(month_data.year, 2014)
     self.assertEqual(month_data.month, 1)