Skip to content

Instantly share code, notes, and snippets.

@abkosar
Created May 30, 2016 01:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abkosar/e44f988df72c23532685d23531e92d29 to your computer and use it in GitHub Desktop.
Save abkosar/e44f988df72c23532685d23531e92d29 to your computer and use it in GitHub Desktop.
jobs_data_science.location = jobs_data_science.location.str.replace('Nyc.*' , 'New York, NY')
jobs_data_science.location = jobs_data_science.location.str.replace('Ny.*' , 'New York, NY')
jobs_data_science.location = jobs_data_science.location.str.replace('New York City.*' , 'New York, NY')
jobs_data_science.location = jobs_data_science.location.str.replace('Brooklyn.*' , 'New York, NY')
jobs_data_science.location = jobs_data_science.location.str.replace('Bronx.*' , 'New York, NY')
jobs_data_science.location = jobs_data_science.location.str.replace('Manhattan.*' , 'New York, NY')
jobs_data_science.location = jobs_data_science.location.str.replace('New York Relocating.*' , 'New York, NY')
jobs_data_science[jobs_data_science.location.str.contains("New York")==True]
jobs_data_science = jobs_data_science[jobs_data_science.location.str.contains("ion")==False]
jobs_data_science = jobs_data_science[jobs_data_science.state.str.contains("j")==False]
jobs_data_science = jobs_data_science[jobs_data_science.state.str.contains("TX")==False]
job_count_by_location = jobs_data_science.groupby(['state', 'location'])['job_title'].agg('count')
job_count_by_location = pd.DataFrame(job_count_by_location)
job_count_by_location.columns = ['Job_Count']
job_count_by_location
job_count_by_location.Job_Count[job_count_by_location.Job_Count > 10].plot(
kind = 'bar', legend = True,
figsize = (12,6),
color = "salmon")
locs, labels = plt.xticks()
plt.setp(labels, rotation=0)
plt.xlabel("Location", fontsize = 15)
plt.ylabel("Job Count", fontsize = 15)
plt.title("Number of Jobs by Location", fontsize = 25)
plt.savefig('job_count_by_location.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment