pandas 인덱스 무작위로 섞기

# 클래스 레이블 무작위로 섞기 : reindex
np.random.seed(0)
df = df.reindex(np.random.permutation(df.index)) # 이 부분 정리
df.to_csv('train_clean.csv',index=False,encoding='utf-8-sig')

 

'Code Cloud > python' 카테고리의 다른 글

python 모듈 라이브러리 워닝 무시  (0) 2022.01.20
pandas 특정 컬럼 값 갯수 세기  (0) 2022.01.20
pandas 특정 행,열 제거  (0) 2022.01.20
전처리 함수 정의  (0) 2022.01.20
url로 이미지 첨부하기  (0) 2022.01.18