df
= df.mean (1)[first them first the the the the the the the the the the the the the the the the the the the the when 나머지 열의 순서를 보존합니다.
import numpy as np import pandas as pd df = pd.DataFrame(np.random.rand(10, 5))솔루션 : 열을 재정렬하는 열
열을 재정렬하는 효과적인 메소드는 수정 된 열 목록과 데이터 프레임을 다시 할인하는 것입니다.
import numpy as np import pandas as pd df = pd.DataFrame(np.random.rand(10, 5))
1 단계 : 열 목록을 배열
cols = df.columns.tolist ()
원하는대로 목록 내 열 순서를 재 배열하십시오. 이 경우, '평균'을 시작 :
cols = df.columns.tolist()
import numpy as np import pandas as pd df = pd.DataFrame(np.random.rand(10, 5))[ # # df] = df.ix [:, cols]
부인 성명: 제공된 모든 리소스는 부분적으로 인터넷에서 가져온 것입니다. 귀하의 저작권이나 기타 권리 및 이익이 침해된 경우 자세한 이유를 설명하고 저작권 또는 권리 및 이익에 대한 증거를 제공한 후 이메일([email protected])로 보내주십시오. 최대한 빨리 처리해 드리겠습니다.
Copyright© 2022 湘ICP备2022001581号-3