[python] dataframe sort_index, sort_values


[python] dataframe sort_index, sort_values

데이터 프레임의 다양한 정렬 방법 예시 sort_index() 와 sort_values()에 대해 그 사용법을 알아봅니다. 0. 샘플로 사용할 dataframe import pandas as pd import numpy as np arr = [[99,2,3,4,5],[99,99,13,14,15],[21,22,23,24,25], [31,32,33,34,35]] ind = ['ind1', 'ind2',np.nan,'ind4'] col = ['col1', 'col2','col3','col4','col5'] df = pd.DataFrame(arr, index = ind, columns = col) print(df) col1 col2 col3 col4 col5 ind1 99 2 3 4 5 ind2 99 99 13 14 15 NaN 21 22 23 24 25 ind4 31 32 33 34 35 [이렇게 생긴 df ] 특이점: index 에 nan, 99 라는 같은값 존재 1. 인덱스 기준 정렬...


#dataframe #df #python #sort_index #sort_values #sorting #조경수최저가 #주니퍼가든

원문링크 : [python] dataframe sort_index, sort_values