시작하기무료로 시작하기

데이터 필터링

영상 강의에서 보셨듯이, 다양한 이유로 데이터를 필터링해야 할 때가 있습니다.

이 연습 문제에서는 필터링을 사용해 DataFrame에서 특정 부분만 선택해 보겠습니다:

  • 요일별로 기록된 항목 수 기준
  • 요일별 고객이 식당에 지불한 평균 금액 기준

이 연습은 강의의 일부입니다

pandas로 효율적인 코드 작성하기

강의 보기

실습형 인터랙티브 연습

이 예제를 이 샘플 코드를 완성하여 풀어보세요.

# Filter the days where the count of total_bill is greater than $40
total_bill_40 = restaurant_data.groupby('day').____(lambda x: ____[____].____() > 40)

# Print the number of tables where total_bill is greater than $40
print('Number of tables where total_bill is greater than $40:', total_bill_40.shape[0])
코드 편집 및 실행