Python
Python 데이터 분석(주피터노트북) - Pandas(Subset-row)(1)
developers developing
2022. 10. 24. 12:00
Subset - row
라이브러리
- import pandas as pd
- import numpy as np
데이터 생성
1) head() / tail()
2) sample() : 임의 값 가지고 오기
3) nlargest() / nsmallest() : 최대값, 최소값
- n 값은 지정 가능
4) drop_duplicates() : 중복행 제거
- duplicated() : 중복된 행이 있는지 True/False로 알려줌
df.drop_duplicates(
subset: Union[Hashable, Sequence[Hashable], NoneType] = None,
keep: Union[str, bool] = 'first',
inplace: bool = False,
ignore_index: bool = False,
) -> Union[ForwardRef('DataFrame'), NoneType]
[실습] student_list
5) 불린 인덱싱
- friend_age 에 비교 연산자를 사용하면 아래처럼 결과를 보여줌
- 따라서 그걸 이용해서 [] 안에 넣어주면 subset을 추출할 수 있음
6) query()
[실습] friend_df
1) head()
2) tail()
3) nlargest()
4) nsmallest()
5) sample()