베이스 테이블 살펴보기
모델을 만들기 전에, 다루는 데이터를 이해하는 것이 중요해요. 이 연습 문제에서는 주어진 베이스 테이블에서 전체 표본 수, 타깃 개수, 타깃 발생률을 계산하는 방법을 배워요.
이 연습은 강의의 일부입니다
Python으로 배우는 예측 분석 입문
연습 안내
- 베이스 테이블은 pandas 객체
basetable에 로드되어 있어요. 행의 개수를 변수population_size에 할당하고 출력하세요. - 값이 1인 타깃의 개수를 변수
targets_count에 할당하고 출력하세요. - 타깃 발생률을 출력하세요. 이는
targets_count를population_size로 나눈 비율이에요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
# Assign the number of rows in the basetable to the variable 'population_size'.
population_size = ____(____)
# Print the population size.
print(____)
# Assign the number of targets to the variable 'targets_count'.
targets_count = ____(____[____])
# Print the number of targets.
print(____)
# Print the target incidence.
print(____ / ____)