Last active
January 5, 2022 23:15
-
-
Save khuyentran1401/ffbf655e3de7a2e72a53fbdb4512ecf2 to your computer and use it in GitHub Desktop.
This file contains 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
# Group by salary range | |
bins = [0, 25_000, 50_000, 75_000, 100_000, 125_000, 150_000, 300_000] | |
normal_salary["Salary Range"] = pd.cut( | |
normal_salary.dropna(subset=["ConvertedSalary"])["ConvertedSalary"], bins=bins | |
) | |
salary_groupby = normal_salary.groupby("Salary Range").agg({"Respondent": "count"}) | |
# Create a bar plot | |
salary_groupby.plot(kind="bar") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment