quantile

TOLL TERRY·2022년 5월 11일
0

recommendation_study

목록 보기
1/11

pandas.quantile(q=0.5)

q = 0.8 (현재 칼럼의 0.8(=80%) 분위수를 나타내보자)

import pandas as pd
import numpy as np

df = pd.read_csv('/movies_metadata.csv')
df.head()
#Calculate the number of votes garnered by the 80th percentile movie
m = df['vote_count'].quantile(0.80)
m

현재 'vote_count' 에서의 백분위 중에 80%에 해당하는 값은 50이다.

그렇다면 우리가 80% 이상인 값을 쓰려면

#Only consider movies that have garnered more than m votes 
movies_20percent = df[df['vote_count'] >= m] 

약 45,000개 중에서 9,000개 정도로 (20% 값을 가져올 것이다.)

##출처
Hands-On-Recommendation-Systems-with-Python

https://github.com/PacktPublishing/Hands-On-Recommendation-Systems-with-Python
profile
행복을 찾아서(크리스 가드너)

0개의 댓글

관련 채용 정보