Reputation: 55
I am trying to learn data science from a tutorial online and am having trouble with graphing the frequency table of Jobtype and SalStat.
https://github.com/gshanbhag525/Programming-Knowledge-/blob/master/income.csv
data_income = pd.read_csv('income.csv')
data2= data.dropna(axis=0)
jobtype_salary_stat= pd.crosstab( index=data2['JobType'],
columns=data2['SalStat'],
margins= True,
normalize='index')
jobtype_salary_stat
fig2=plt.figure(figsize=(10,10))
plt.subplot(2,2,1)
sns.countplot(x='JobType', hue="SalStat", data=data2, order=[0,1]).set_title('Does Job type affect
salary?')
How do I graph the job types and different frequency of salary? I thought of mapping the salary stat as 0 for under 50,000 and 1 for over 50,000 and then graphing it but got an error. So I tried creating a data frame of jobtype_salary_stat and plotting a histogram but that didn't work. I am not sure what I am not understanding or missing. What I am trying to graph is the different job types with different frequencies of salary either under or over 50,000. Is there a way to do this, or are their intermediate steps that have to be taken before it can be done? Thank you for any help. :)
Upvotes: 2
Views: 2097
Reputation: 332
If you just want a simple plot, Pandas has a useful built-in data visualization tool. In your case you could plot a bar plot
jobtype_salary_stat.plot.bar()
Upvotes: 1