col=['country', 'province', 'region_1', 'region_2']
ind=[0,1,10,100]
df=reviews.loc[ind,col]
italian_wines = reviews.loc[reviews.country == 'Italy']
top_oceania_wines = reviews.loc[(reviews.points >= 95)
& (reviews.country.isin(['Australia','New Zealand']))]
참고
https://www.kaggle.com/code/residentmario/indexing-selecting-assigning
'파이썬' 카테고리의 다른 글
[판다스] 결측치 확인, isnull(), notnull() (0) | 2024.01.30 |
---|---|
[판다스] dtype, dtypes, astype() (0) | 2024.01.30 |
[판다스] groupby 활용법 (0) | 2024.01.30 |
[판다스] map에서 lambda 쓰기, apply 쓰기 (0) | 2024.01.27 |
[판다스] df.idxmax(): 값이 가장 큰 행의 인덱스 반환 (0) | 2024.01.26 |