Published on 11/18/2024 12:05 by Adam Surette
Interactive Dashboard
If you would like to view this on a larger screen, use the full screen button or click here
Data Sources
Median US House prices: DQYDJ article by PK called ‘Historical US Home Prices: Monthly Median from 1953-2024’. They used data from the folowing sources to build this dataset: National Association of Realtors, Median Sales Price of Existing Homes Robert Shiller’s NSA Existing Home Sale Index The FHFA’s NSA Existing Home Sale Index
Median Personal Income: Federal Reserve Economic Database dataset called ‘Real Median Personal Income in the United States’ using data sourced from the US Census Bureau.
Federal Minimum Wage: The federal minimum wage history is readily available from a wide variety of reputable sources.
Calculating Values Adjusted to 2023
I added all the data collected above to an Excel spreadsheet with the columns
Year | Federal Minimum Wage | Median House Price | Median Personal Income |
---|
I exported the unadjusted csv and wrote an adjustment calculator in python. I used Python CPI to calculate inflation with the “CPI-U” index as recommended by the Bureau of Labor Statistics.
import cpi
import pandas as pd
# Read Unadjusted CSV
csv_path = "/.../.../.../.../non_adjusted.csv"
df_USA = pd.read_csv(csv_path)
# Remove all non A-Z, a-z, ., and whitespaces
df_USA['FEDERAL_MINIMUM_WAGE'] = df_USA['FEDERAL_MINIMUM_WAGE'].replace(r'[^A-Za-z0-9.\s]', '', regex=True)
# Format other columns
df_USA['FEDERAL_MINIMUM_WAGE'] = df_USA['FEDERAL_MINIMUM_WAGE'].astype('float')
df_USA['YEAR'] = df_USA['YEAR'].astype('int')
# Iterate over each row in df_bigmac
for index, row in df_USA.iterrows():
# Extract data from the filled columns
year = row['YEAR'].astype('int')
fed_wage = row['FEDERAL_MINIMUM_WAGE']
med_house = row['MEDIAN_HOUSE_PRICE']
med_income = row['MEDIAN_PERSONAL_INCOME']
# Replace the data in the NaN columns with inflated amount (to 2023)
# loc the index and row first and set as result
df_USA.loc[index, 'FEDERAL_MINIMUM_WAGE_ADJ'] = cpi.inflate(fed_wage, year, to=2023)
df_USA.loc[index, 'MEDIAN_HOUSE_PRICE_ADJ'] = cpi.inflate(med_house, year, to=2023)
df_USA.loc[index, 'MEDIAN_PERSONAL_INCOME_ADJ'] = cpi.inflate(med_income, year, to=2023)
# Write the results to csv
df_USA.to_csv('USA_stats.csv', index=False)
Written by Adam Surette
← Back to all projects