문제
Count the number of movies that Abigail Breslin nominated for oscar
Count the number of movies that Abigail Breslin was nominated for an oscar.
애비게일 브레슬린이 오스카에 노미네이트한 영화 수 세기
코드
# Import your libraries
import pandas as pd
# Start writing code
# solution 1
result = oscar_nominees[oscar_nominees['nominee'] == 'Abigail Breslin']
len(result)
# solution 2
result = oscar_nominees[oscar_nominees['nominee'].isin(['Abigail Breslin'])]
len(result)
- nominee인 열에 Abigail Breslin이 들어있는 조건을 줘서 뽑기
- 행의 개수를 뽑아줌
출처
반응형
'Algorithm > Python' 카테고리의 다른 글
[stratascratch] find the top 10 ranked songs in 2010(Python) (0) | 2021.08.15 |
---|---|
[stratascratch] number of bathrooms and bedrooms(Python) (0) | 2021.08.15 |
[프로그래머스] 모의고사 (Python) (0) | 2021.07.22 |
[백준알고리즘] 1934번 최소공배수 (Python) (0) | 2021.07.13 |
[백준알고리즘] 10039번 평균점수 (Python) (0) | 2021.07.12 |