렌덤행 추출
df.sample(n = '추출할 행 갯수', frac = '추출할 데이터 비율(0~1)', replace = 'True(복원)', 'False(비복원)')
중복된 행 제거
df.drop_duplicates()
특정 조건 행 추출
condition = (df.col_1 >= 100) & (df.col_2 != 0) # 조건식
df[condition] # 추출
df[(df['col_1'] >= 100) & (df['col_2'] != 0)] # 추출
둘다 같음
특정 조건 행 수정
df.loc[df['col_1'] == 90, 'col_1'] = 10
특정 index 행 제거
df.drop(index = [index리스트], axis = 0, inplace = True)
index 다시 정렬
df.reset_index(drop = False, inplace = True)
특정 컬럼 정렬
df.sort_values(by=["c1"], ascending=[True])
제가 올린 글에서 잘못된 부분이 있으면 제 메일로 연락주세요!
이승수의 저작물인 이 저작물은(는) 크리에이티브 커먼즈 저작자표시-비영리-동일조건변경허락 4.0 국제 라이선스에 따라 이용할 수 있습니다.