Last active
September 14, 2024 20:38
-
-
Save JettIsOnTheNet/3cf291e7ce94839329bfe97381f8fe7b to your computer and use it in GitHub Desktop.
Software Job Market Comparison Graph
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| # load | |
| # https://fred.stlouisfed.org/series/IHLIDXUSTPHUMARESO | |
| df_hr = pd.read_csv('IHLIDXUSTPHUMARESO.csv', parse_dates=['DATE']) | |
| # https://fred.stlouisfed.org/series/IHLIDXUSTPSOFTDEVE | |
| df_software = pd.read_csv('IHLIDXUSTPSOFTDEVE.csv', parse_dates=['DATE']) | |
| # https://fred.stlouisfed.org/series/IHLIDXUSTPPROJMANA | |
| df_pm = pd.read_csv('IHLIDXUSTPPROJMANA.csv', parse_dates=['DATE']) | |
| # https://fred.stlouisfed.org/series/IHLIDXUSTPSALE | |
| df_sales = pd.read_csv('IHLIDXUSTPSALE.csv', parse_dates=['DATE']) | |
| # https://fred.stlouisfed.org/series/IHLIDXUSTPRETA | |
| df_retail = pd.read_csv('IHLIDXUSTPRETA.csv', parse_dates=['DATE']) | |
| # https://fred.stlouisfed.org/series/IHLIDXUSTPITOPHE | |
| df_it_ops = pd.read_csv('IHLIDXUSTPITOPHE.csv', parse_dates=['DATE']) | |
| def adjust_values(df, column_name): | |
| initial_value = df[column_name].iloc[0] | |
| df['Adjusted Value'] = df[column_name] - (initial_value - 100) | |
| adjust_values(df_hr, 'IHLIDXUSTPHUMARESO') | |
| adjust_values(df_software, 'IHLIDXUSTPSOFTDEVE') | |
| adjust_values(df_pm, 'IHLIDXUSTPPROJMANA') | |
| adjust_values(df_sales, 'IHLIDXUSTPSALE') | |
| adjust_values(df_retail, 'IHLIDXUSTPRETA') | |
| adjust_values(df_it_ops, 'IHLIDXUSTPITOPHE') | |
| plt.figure(figsize=(14, 8)) | |
| plt.plot(df_hr['DATE'], df_hr['Adjusted Value'], color='b', label='HR Job Postings', linewidth=1) | |
| end_hr_value = df_hr['Adjusted Value'].iloc[-1] | |
| lowest_hr_value = df_hr['Adjusted Value'].min() | |
| percent_diff_lowest_hr = ((end_hr_value - lowest_hr_value) / lowest_hr_value) * 100 | |
| percent_diff_100_hr = ((end_hr_value - 100) / 100) * 100 | |
| plt.text(df_hr['DATE'].iloc[-1], end_hr_value, | |
| f'{end_hr_value:.2f}\n({percent_diff_lowest_hr:.2f}% from lowest, {percent_diff_100_hr:.2f}% from 100)', | |
| color='b', fontsize=9, ha='right') | |
| plt.plot(df_software['DATE'], df_software['Adjusted Value'], color='r', label='Software Dev Job Postings', linewidth=1) | |
| end_software_value = df_software['Adjusted Value'].iloc[-1] | |
| lowest_software_value = df_software['Adjusted Value'].min() | |
| percent_diff_lowest_software = ((end_software_value - lowest_software_value) / lowest_software_value) * 100 | |
| percent_diff_100_software = ((end_software_value - 100) / 100) * 100 | |
| plt.text(df_software['DATE'].iloc[-1], end_software_value, | |
| f'{end_software_value:.2f}\n({percent_diff_lowest_software:.2f}% from lowest, {percent_diff_100_software:.2f}% from 100)', | |
| color='r', fontsize=9, ha='right') | |
| plt.plot(df_pm['DATE'], df_pm['Adjusted Value'], color='g', label='Project Management Job Postings', linewidth=1) | |
| end_pm_value = df_pm['Adjusted Value'].iloc[-1] | |
| lowest_pm_value = df_pm['Adjusted Value'].min() | |
| percent_diff_lowest_pm = ((end_pm_value - lowest_pm_value) / lowest_pm_value) * 100 | |
| percent_diff_100_pm = ((end_pm_value - 100) / 100) * 100 | |
| plt.text(df_pm['DATE'].iloc[-1], end_pm_value, | |
| f'{end_pm_value:.2f}\n({percent_diff_lowest_pm:.2f}% from lowest, {percent_diff_100_pm:.2f}% from 100)', | |
| color='g', fontsize=9, ha='right') | |
| plt.plot(df_sales['DATE'], df_sales['Adjusted Value'], color='m', label='Sales Job Postings', linewidth=1) | |
| end_sales_value = df_sales['Adjusted Value'].iloc[-1] | |
| lowest_sales_value = df_sales['Adjusted Value'].min() | |
| percent_diff_lowest_sales = ((end_sales_value - lowest_sales_value) / lowest_sales_value) * 100 | |
| percent_diff_100_sales = ((end_sales_value - 100) / 100) * 100 | |
| plt.text(df_sales['DATE'].iloc[-1], end_sales_value, | |
| f'{end_sales_value:.2f}\n({percent_diff_lowest_sales:.2f}% from lowest, {percent_diff_100_sales:.2f}% from 100)', | |
| color='m', fontsize=9, ha='right') | |
| plt.plot(df_retail['DATE'], df_retail['Adjusted Value'], color='c', label='Retail Job Postings', linewidth=1) | |
| end_retail_value = df_retail['Adjusted Value'].iloc[-1] | |
| lowest_retail_value = df_retail['Adjusted Value'].min() | |
| percent_diff_lowest_retail = ((end_retail_value - lowest_retail_value) / lowest_retail_value) * 100 | |
| percent_diff_100_retail = ((end_retail_value - 100) / 100) * 100 | |
| plt.text(df_retail['DATE'].iloc[-1], end_retail_value, | |
| f'{end_retail_value:.2f}\n({percent_diff_lowest_retail:.2f}% from lowest, {percent_diff_100_retail:.2f}% from 100)', | |
| color='c', fontsize=9, ha='right') | |
| plt.plot(df_it_ops['DATE'], df_it_ops['Adjusted Value'], color='purple', label='IT Operations', linewidth=1) | |
| end_it_ops_value = df_it_ops['Adjusted Value'].iloc[-1] | |
| lowest_it_ops_value = df_it_ops['Adjusted Value'].min() | |
| percent_diff_lowest_it_ops = ((end_it_ops_value - lowest_it_ops_value) / lowest_it_ops_value) * 100 | |
| percent_diff_100_it_ops = ((end_it_ops_value - 100) / 100) * 100 | |
| plt.text(df_it_ops['DATE'].iloc[-1], end_it_ops_value, | |
| f'{end_it_ops_value:.2f}\n({percent_diff_lowest_it_ops:.2f}% from lowest, {percent_diff_100_it_ops:.2f}% from 100)', | |
| color='purple', fontsize=9, ha='right') | |
| # horiz indicator | |
| plt.axhline(y=100, color='k', linestyle='--', linewidth=1, label='Reference Line (100)') | |
| # plot | |
| plt.title('Job Postings and IT Operations Comparison (Adjusted)') | |
| plt.xlabel('Date') | |
| plt.ylabel('Value') | |
| plt.grid(True) | |
| plt.xticks(rotation=45) | |
| plt.legend() | |
| plt.tight_layout() | |
| plt.show() |
Author
JettIsOnTheNet
commented
Sep 14, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment