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)로 설정해주세요
기출 11회 작업형 2_전체 데이터 학습 여부
0
18
1
예측값 결과 소수점 차이
0
23
2
기출 문제와 실전챌린지 연습문제 무엇부터 푸는게 나은가요?
0
17
0
전처리 train() test([ ])
0
18
2
작업형 1 배경지식 질문
0
20
2
옳게 풀은건지 질문드립니다!
0
14
1
roc_auc_score
0
24
2
추가질문 합니다
0
17
2
시험환경 구름
0
18
2
2유형 질문드려요
0
17
2
RandomForest vs lgb
0
24
2
전처리 관련질문
0
25
3
작업형3 기출
0
18
2
유형2에서 데이터분할 생략 가능여부
0
30
2
9회 기출 유형3 질문
0
21
2
lgb 기초편
0
14
1
괄호 사용
0
24
2
작업형 2 데이터 전처리 질문
0
22
1
11회 기출 유형 작업형1 문제 3-1
0
20
1
예시문제 작업형2 (ver2023) 질문입니다
0
20
2
Data type에 따른 처리
0
21
2
데이터 전처리 관련
0
19
2
시험에서 문제 불러오기
0
20
2
2번문제 출력값 질문
0
27
2





