2016년 6월 30일 목요일

파이썬 - 간단한 연봉과 근속연수에 대한 그래프 출력 데모

파이썬을 배우면 보다 쉽게 데이터 분석이 가능한 시대입니다. ㅋㅋ
예시로 되어 있는 데이터는 물론 미국 데이터 입니다.
salaries_and_tenures = [(83000, 8.7), (88000, 8.1),
(48000, 0.7), (76000, 6),
(69000, 6.5), (76000, 7.5),
(60000, 2.5), (83000, 10),
(48000, 1.9), (63000, 4.2)]
def make_chart_salaries_by_tenure():
tenures = [tenure for salary, tenure in salaries_and_tenures]
salaries = [salary for salary, tenure in salaries_and_tenures]
plt.scatter(tenures, salaries)
plt.xlabel("Years Experience")
plt.ylabel("Salary")
plt.show()

써머리한 결과는 아래와 같습니다. 2년차 이하, 2년에서 5년차, 5년차 이상인 경우
average_salary_by_bucket
Out[77]:
{u'between two and five': 61500.0,
u'less than two': 48000.0,
u'more than five': 79166.66666666667}


댓글 없음:

댓글 쓰기

참고: 블로그의 회원만 댓글을 작성할 수 있습니다.

인공지능 모델의 생태계를 정리해 주신 분이 계셔서 한번 올려봅니다.

 하루가 다르게 시장이 변하고 있어서 공부하기가 벅찹니다. ㅋㅋ