데이터 분석
데이터프레임 groupby 함수 정복하기
민아당긴아
2024. 10. 25. 01:09
groupby 함수
df_new = df.groupby(by = [그룹화기준열]).집계함수.reset_index()
- 집계함수: sum(), mean()
- reset_index(): 그룹화에서 사용된 열들을 인덱스 > 열로 바꾼다.
df3 = df2.groupby("예보 등급")["count"].count().reset_index()
.startswith(특정문자)
특정문자로 시작하는 것들만 뽑아낸다.
[ x for x in house_year.columns if x.startswith('p') ]