df.sum() 과 sum(df) 차이가 뭔가요?
df.sum() 과 sum(df) 차이가 무엇인지 질문드립니다.
답변 2
1
Hello this is Gulshan Negi
Well, I search about it on internet and in short I can say.
The main difference between df.sum() and sum(df) is their usage and the objects they operate on.
df.sum() is a pandas DataFrame method that calculates the sum of each column by default. It returns a new pandas Series object containing the column-wise sums. It provides flexibility in specifying the axis of summation and handling missing or non-numeric values appropriately.
On the other hand, sum(df) is a built-in Python function that attempts to iterate over the columns of a data frame and calculate their sum. However, this usage might not work as intended because DataFrames are not inherently iterable in the same way as Python lists or tuples.
Thanks
0
sum(df) 파이썬 기본 함수
df.sum() 판다스 함수(정확히는 메소드)
입니다 💪
숫자외에 문자 컬럼이 있을 경우 판다스 버전이 업데이트되면서 워닝이 발생해요
df.sum(numeric_only=True)로 설정해주세요
작업형2 카테고리
0
8
1
110강 회귀_8번 문의
0
9
2
XGBRegressor 학습 시 warning 출력
0
13
2
데이터 프레임을 변경해도 되나요?
0
10
2
10회 기출 작업형3 문제 2-1 질문
0
16
2
작업형 2 질문
0
16
2
작업형 2 템플릿 확인 요청
0
13
2
작업형2 인코딩 질문
0
22
2
작업형 3 벼락치기 공부방법 질문
0
31
2
기출 11회 작업형 2_전체 데이터 학습 여부
0
32
2
예측값 결과 소수점 차이
0
28
2
기출 문제와 실전챌린지 연습문제 무엇부터 푸는게 나은가요?
0
36
1
전처리 train() test([ ])
0
23
2
작업형 1 배경지식 질문
0
33
2
옳게 풀은건지 질문드립니다!
0
22
1
roc_auc_score
0
30
2
추가질문 합니다
0
22
2
시험환경 구름
0
21
2
2유형 질문드려요
0
21
2
RandomForest vs lgb
0
30
2
전처리 관련질문
0
29
3
작업형3 기출
0
22
2
유형2에서 데이터분할 생략 가능여부
0
33
2
9회 기출 유형3 질문
0
23
2





