The program allows users to view highest and lowest salaries, adjusted salaries, average salary, and correlation between teacher pay and living costs. This is relevant because it shows how salary alone doesn’t tell the full story—adjusted income gives a clearer picture of financial well-being across different states.
This program is designed to analyze and compare teacher salaries across the United States by incorporating cost of living data. It loads a dataset from a Google Sheet, processes the data into dictionaries, and presents users with a menu to perform various statistical analyses. The user can view raw salary extremes, cost-of-living-adjusted salary comparisons, the national average salary, and the correlation between salary and living costs. The program is organized using modular functions, with a main loop that controls menu navigation and input validation, ensuring smooth interaction until the user chooses to exit.
The expected output of this script is an interactive, menu-driven program that allows users to analyze teacher salary data in several ways. Based on the user’s choice, the script will display:
The states with the highest and lowest teacher salaries
The states with the highest and lowest cost-of-living-adjusted salaries
The average teacher salary across all states
The correlation between salaries and cost of living
The menu repeats until the user selects the exit option, ensuring continuous access to data insights.
data_teacher- A string containing the URL of the Google Sheets dataset in CSV format.
d_teacher: A pandas DataFrame that loads the dataset from the CSV URL.
teacher_salaries: A dictionary mapping each state to its average teacher salary.
cost_of_living_index: A dictionary mapping each state to its cost of living index.
adjusted_salaries: A dictionary that stores the cost-of-living-adjusted salaries for each state.
highest: A variable used to store the state with the highest salary (or adjusted salary).
lowest: A variable used to store the state with the lowest salary (or adjusted salary).
avg_salary: A float representing the average teacher salary across all states.
salaries: A list of teacher salaries extracted from the teacher_salaries dictionary.
cost_index: A list of cost-of-living values extracted from the cost_of_living_index dictionary.
correlation: A float representing the correlation coefficient between teacher salaries and cost of living.
choice: An integer representing the user’s menu selection for different analysis options.
Functions Analysis Script