LernerPython 블로그, Reuven Lerne... 노트

LernerPython 블로그, Reuven Lerner 제공: Pandas groupby: 여러 함수로 여러 열 집계하기

Python Pandas는 여러 데이터 열과 여러 메서드를 허용합니까?네!df.groupby('passenger_count')[['trip_distance', 'total_amount']].agg(['mean', 'std'])위 코드는 데이터 프레임을 반환합니다. 이 데이터 프레임의 4개 열은 2단계 멀티 인덱스이며 내부 레벨에는 mean/std가 있습니다.
CdXz5zHNQW_SH2qLnYdGP.png