단일 시트 선택하기
하나의 Excel 통합 문서에는 서로 관련된 여러 시트가 들어 있을 수 있어요. New Developer Survey 응답 통합 문서에는 연도별 시트가 있습니다. read_excel()은 기본적으로 첫 번째 시트만 불러오기 때문에, 이미 2016년 응답을 가져온 상태예요. 이제 read_excel()의 sheet_name 인자를 두 가지 방식으로 사용해 2017년 응답 데이터프레임을 만들어 보세요.
pandas는 pd로 임포트되어 있습니다.
이 연습은 강의의 일부입니다
pandas로 빠르고 간편한 데이터 적재
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Create df from second worksheet by referencing its position
responses_2017 = pd.read_excel("fcc_survey.xlsx",
____)
# Graph where people would like to get a developer job
job_prefs = responses_2017.groupby("JobPref").JobPref.count()
job_prefs.plot.barh()
plt.show()