Commit 077033ffe5

077033ffe5ad0a86d138572d86e1fda70c16bf37

parent: 6bb158233b

Unsigned

cmc <hello@cleberg.net> · 2024-06-16 20:37 UTC

add salary visualization tool and results

Layout: unified · split

content/salary.md +11 −2
@@ -3,7 +3,9 @@ title = "Salary"
3draft = false 3draft = false
4+++ 4+++
5 5
6# Salary Transparency 6<link rel="stylesheet" href="https://unpkg.com/charts.css/dist/charts.min.css">
7
8## Salary Transparency
7 9
8The data below details the base salary information for each job I've held. This 10The data below details the base salary information for each job I've held. This
9information is posted publicly to ensure others in my position have a solid 11information is posted publicly to ensure others in my position have a solid
@@ -24,7 +26,7 @@ paid differently (expertise, years of experience, certifications, education,
24etc.) and that the data in this table should only be used as a single point of 26etc.) and that the data in this table should only be used as a single point of
25reference, not the whole story. 27reference, not the whole story.
26 28
27# Salary Data 29## Salary Data
28 30
29Note: When in a role that gives periodic raises, I will create a new record with 31Note: When in a role that gives periodic raises, I will create a new record with
30the new base salary in the table below. See the KPMG records for an example of a 32the new base salary in the table below. See the KPMG records for an example of a
@@ -43,6 +45,13 @@ raise while in the same role.
43| Teaching Assistant | University of Nebraska | Lincoln, NE | 2017-08 | 2018-05 | $7/hour | 45| Teaching Assistant | University of Nebraska | Lincoln, NE | 2017-08 | 2018-05 | $7/hour |
44| Community Management Intern | Walgreens | Lincoln, NE | 2017-06 | 2018-02 | $14/hour | 46| Community Management Intern | Walgreens | Lincoln, NE | 2017-06 | 2018-02 | $14/hour |
45 47
48## Salary Visualization
49
50See the graph below for a visualization of each job's salary over time, as well
51as percentage increases or decreases between jobs.
52
53![Salary Visualization](https://img.cleberg.net/blog/salary/salary.png)
54
46This page was inspired by [Xe](https://xeiaso.net/salary-transparency/), and I'm 55This page was inspired by [Xe](https://xeiaso.net/salary-transparency/), and I'm
47quoting the following wording from them as I want to reiterate this piece: 56quoting the following wording from them as I want to reiterate this piece:
48 57
salary_visualization.py added +56
@@ -0,0 +1,56 @@
1# %pip install plotly pandas
2
3import pandas as pd
4import plotly.graph_objs as go
5import locale
6
7locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
8
9df = pd.read_csv('~/Downloads/salary.csv')
10
11# Reverse the order of the DataFrame
12df = df.iloc[::-1].reset_index(drop=True)
13
14# Calculate the percentage increase
15df['Percentage Increase'] = df['Salary'].pct_change() * 100
16
17# Initialize the plot
18fig = go.Figure()
19
20# Adding each data point as a separate trace to display the text
21for index, row in df.iterrows():
22 title_company = f"{row['Title']} ({row['Company']})"
23 salary_formatted = format_currency(row['Salary'])
24 if pd.notna(row['Percentage Increase']):
25 text = f"{salary_formatted} ({row['Percentage Increase']:.2f}%)"
26 else:
27 text = salary_formatted
28 fig.add_trace(go.Scatter(
29 x=[row['Start'], row['End']],
30 y=[row['Salary'], row['Salary']],
31 text=[text],
32 mode='lines+text',
33 name=title_company, # Combine title and company for legend
34 textposition='top center'
35 ))
36
37fig.update_layout(
38 title="Salary Data Over Time (annualized)",
39 xaxis_title="Time",
40 yaxis_title="Salary",
41 font=dict(
42 family="monospace",
43 size=16
44 ),
45 margin=dict(l=50, r=50, t=50, b=100), # Adjust bottom margin for legend space
46 legend=dict(
47 orientation="h", # Horizontal orientation
48 yanchor="top", # Anchor to the top of the legend box
49 y=-0.3, # Position below the graph
50 xanchor="center", # Center the legend horizontally
51 x=0.5 # Center the legend
52 ),
53 height=800 # Increase vertical size
54)
55
56fig.show()