Python/Python Lib

[Pandas] 데이터 분석 용 함수 모음

heheh 2021. 1. 6. 20:36

 

컬럼별로 데이터 확인

그룹별로 데이터 집계하기 df.groupby()
그룹별로 개수세기 pd.Series.value_counts()
유니크한 값 구하기 pd.Series.unique()
행에 접근 df.itertuples()

 

이상 데이터 처리

결측 데이터 찾기 df.isnull() / df.isnull().sum()
결측 데이터를 포함한 행 삭제 df.dropna()
중복 데이터 찾기 df.duplicated() / df.duplicated().sum()
중복 데이터를 포함한 행 삭제 df.drop_duplicates()

 

직접 데이터 처리

행 삭제 df.drop(['index명'])
(조건으로 하고싶다면 ['index명']에
df.loc[df.column명 == 1].index )

 

 

데이터 범위 나누기

pd.cut(bins = ())
pd.Series.value_count(bins = )