Exemple #1
0
def company_exploring(data):
    
    print("loading data....")
    company_data = company_level(data)
    
    Flag = True
    while Flag:
        try:
            

            print ("================================ H1b Visa Approve Rate Exploring ================================")
            print ("")
            print ("                             Please choose ONE level you interested in                           ")
            print ("                              <a>  : Popular Company                                             ")
            print ("                              <b>  : Customized Company Inquiry                                  ")
            print ("                              <r>  : Go back to the main menu                                    ")  
            print ("")
            print ("=================================================================================================")
    


            key = option_input()
            if key == 'a':
                popular_company(company_data)
            if key == 'b':
                customized_company(company_data)
            if key == 'r':
                Flag = False
        
        except wrong_option_exception:
            print ("Invalid option, please reselect.")
Exemple #2
0
def overview(data):

    data = h1b_data(data)

    print(
        "================================ H1b Visa Approve Rate Exploring ================================"
    )
    print("")
    print(
        "                             Please choose one topic you interested in                           "
    )
    print(
        "                              <a>  : Application Pool                                            "
    )
    print(
        "                              <b>  : Approval Rate                                               "
    )
    print(
        "                              <c>  : Average Wage                                                "
    )
    print(
        "                              <r>  : Go back to previous directory                               "
    )
    print("")
    print(
        "================================================================================================="
    )

    Flag = True
    while Flag:
        try:
            key = option_input()
            if key == 'a':
                application_pool = data.calc_application_pool('Overview')
                plot_line_chart(application_pool, 'Application Pool Size',
                                'Overview of Application Pool')

            if key == 'b':
                APPROVE_RATE_LIST = data.calc_approve_rate('Overview')
                plot_line_chart(APPROVE_RATE_LIST, 'Approve Rate (%)',
                                'Overview of Approve Rate')

            if key == 'c':
                AVERAGE_WAGE_LIST = data.calc_average_wage('Overview')
                plot_line_chart(AVERAGE_WAGE_LIST, 'Average Wage',
                                'Overview of Average Wage')

            if key == 'r':
                Flag = False

        except KeyboardInterrupt:
            sys.exit(1)
        except wrong_option_exception:
            print("Invalid option, please reselect.")
Exemple #3
0
def main():
    """
    The whole project start here.
    """

    # start at loading the dataset
    data = h1bdata_loading()
    merged_data = pd.concat([data[year] for year in range(2010, 2017)],
                            ignore_index=True)
    raw_data = h1b_data(data)

    # Then clean the data
    #h1b_data = Clean_df(raw_data)
    #print("data cleaned >>>")

    while True:
        try:
            print(
                "================================ H1b Visa Approve Rate Exploring ================================"
            )
            print("")
            print(
                "                             How do you want to explore the H1b Data?                            "
            )
            print(
                "                              <a>  : Overview                              		                 "
            )
            print(
                "                              <b>  : Location                                                    "
            )
            print(
                "                              <c>  : Industry                                                    "
            )
            print(
                "                              <d>  : Company                                                     "
            )
            print(
                "                              You can always input 'quit' to leave the system                    "
            )
            print(
                "================================================================================================="
            )

            key = option_input()
            if key == 'a':
                overview(data)
            if key == 'b':
                location(data)
            if key == 'c':
                industry_exploring(merged_data)
            if key == 'd':
                company_exploring(merged_data)
        except wrong_option_exception:
            print("Invalid option, please reselect.")
Exemple #4
0
def popular_industry(industry_data):

    Flag = True
    while Flag:
        try:
            print(
                "================================ H1b Visa Approve Rate Exploring ================================"
            )
            print("")
            print(
                "                             Please choose ONE Rank you interested in                            "
            )
            print(
                "                              <a>  : Application Pull                                            "
            )
            print(
                "                              <b>  : Approve Rate                                                "
            )
            print(
                "                              <c>  : Average Wage                                                "
            )
            print(
                "                              <r>  : Go back to previous directory                               "
            )
            print("")
            print(
                "================================================================================================="
            )

            key = option_input()

            if key == 'a':
                user_input = input(
                    "please input number of industries you want to show in this rank, please enter an integer between 5 and 20\n"
                )
                try:
                    if user_input == 'quit':
                        sys.exit(1)
                    else:
                        try:
                            number = int(user_input)
                            if number <= 20 and number >= 5:
                                industry_data.occupation_rank(
                                    industry_data, number, "application_pool")
                                confirm_answer_ploting(industry_data, number,
                                                       "application_pool")
                                break
                            else:
                                raise wrong_int_exception

                        except wrong_int_exception:
                            print(
                                "Invalid input, please reenter an integer between 5 and 20\n"
                            )

                except wrong_int_exception:
                    print(
                        "Invalid input, please reenter an integer between 5 and 20\n"
                    )
                except KeyboardInterrupt:
                    sys.exit(1)
                except EOFError:
                    sys.exit(1)

            if key == 'b':
                user_input = input(
                    "please input number of industries you want to show in this rank, please enter an integer between 5 and 20\n"
                )
                try:
                    if user_input == 'quit':
                        sys.exit(1)
                    else:
                        try:
                            number = int(user_input)
                            if number <= 20 and number >= 5:
                                industry_data.occupation_rank(
                                    industry_data, number, "approval_rate")
                                confirm_answer_ploting(industry_data, number,
                                                       "approval_rate")
                                break
                            else:
                                raise wrong_int_exception

                        except wrong_int_exception:
                            print(
                                "Invalid input, please reenter an integer between 5 and 20\n"
                            )

                except wrong_int_exception:
                    print(
                        "Invalid input, please reenter an integer between 5 and 20\n"
                    )
                except KeyboardInterrupt:
                    sys.exit(1)
                except EOFError:
                    sys.exit(1)

            if key == 'c':
                user_input = input(
                    "please input number of industries you want to show in this rank, please enter an integer between 5 and 20\n"
                )
                try:
                    if user_input == 'quit':
                        sys.exit(1)
                    else:
                        try:
                            number = int(user_input)
                            if number <= 20 and number >= 5:
                                industry_data.occupation_rank(
                                    industry_data, number, "average_wage")
                                confirm_answer_ploting(industry_data, number,
                                                       "average_wage")
                                break
                            else:
                                raise wrong_int_exception

                        except wrong_int_exception:
                            print(
                                "Invalid input, please reenter an integer between 5 and 20\n"
                            )

                except wrong_int_exception:
                    print(
                        "Invalid input, please reenter an integer between 5 and 20\n"
                    )
                except KeyboardInterrupt:
                    sys.exit(1)
                except EOFError:
                    sys.exit(1)

            if key == 'r':
                Flag = False

        except wrong_option_exception:
            print("Invalid option, please reselect.")
Exemple #5
0
def national_level(h1b_data):

    print("  ")
    print(
        "================================ H1b Visa Approve Rate Exploring ================================="
    )
    print("")
    print(
        "          You are now at National Level, please choose ONE indicator you interested in                "
    )
    print(
        "                              <a>  : Application Pool                                             "
    )
    print(
        "                              <b>  : Approve Rate                                                 "
    )
    print(
        "                              <c>  : Average Wage                                                 "
    )
    print(
        "                              <r>  : Return to Location Menu                                      "
    )
    print(
        "                      WARNING: For Year Input : Only 2010 ~ 2016                                  "
    )
    print("")
    print(
        "=================================================================================================="
    )
    Flag = True

    while Flag:
        try:
            key = option_input()
            if key == 'a':
                year = input('Please input the year you are interested in: ')
                if year in [
                        '2010', '2011', '2012', '2013', '2014', '2015', '2016'
                ]:
                    year = int(year)
                    application_pool = h1b_data.calc_application_pool(
                        'Country', year)
                    plot_cloropleth_map(application_pool, 'Application Pool',
                                        'Pool Size', year)
                    print(
                        "The information you requested has been saved, please use browser to open it..."
                    )
                elif year == 'quit':
                    sys.exit(1)
                else:
                    raise wrong_option_exception
            if key == 'b':
                year = input('Please input the year you are interested in: ')
                if year in [
                        '2010', '2011', '2012', '2013', '2014', '2015', '2016'
                ]:
                    year = int(year)
                    APPROVE_RATE_LIST_Country = h1b_data.calc_approve_rate(
                        'Country', year)
                    plot_cloropleth_map(APPROVE_RATE_LIST_Country,
                                        'Approve Rate', 'approve rate (%)',
                                        year)
                    print(
                        "The information you requested has been saved, please use browser to open it..."
                    )
                elif year == 'quit':
                    sys.exit(1)
                else:
                    raise wrong_option_exception
            if key == 'c':
                year = input('Please input the year you are interested in: ')
                if year in [
                        '2010', '2011', '2012', '2013', '2014', '2015', '2016'
                ]:
                    AVERAGE_WAGE_LIST_Country = h1b_data.calc_average_wage(
                        'Country', int(year))
                    plot_cloropleth_map(AVERAGE_WAGE_LIST_Country,
                                        'Average Wage', 'average wage ($)',
                                        int(year))
                    print(
                        "The information you requested has been saved, please use browser to open it..."
                    )
                elif year == 'quit':
                    sys.exit(1)
                else:
                    raise wrong_option_exception
            if key == 'r':
                Flag = False
        except wrong_option_exception:
            print(
                "Invalid option, please reselect an indicator you interested in."
            )