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)로 설정해주세요
수업노트가 어디에 있나요?
0
5
1
실기시험 제출관련
0
137
2
6.20 작업형 2 과적합
0
146
3
코딩팡 장업형2 베이스 라인 인코딩 종류 질문
0
47
2
로지스틱회귀, 회귀
0
47
2
회귀 문제를 풀때 질문입니다.
0
53
1
불균형 처리 후 성능이 더 낮아졌다면,
0
61
2
실기 체험 제2유형 에러 문의
0
60
1
LIGHTGBM 으로 하면 pred값이 소수점 6자리까지 나오는게 맞나요
0
47
2
3번문제 등분산 가정
0
46
2
작업형3 target 형 변환 질문
0
34
2
[작업형1] 연습문제 섹션1 ~ 10 의 section4
0
36
3
원핫인코딩과 레이블 인코딩에서 concat
0
57
2
제2유형 질문입니다.
0
46
2
C()
0
44
2
작업형 2에서 strafity 적용 유무
0
50
2
수강 기간 연장 가능 여부 문의드립니다.
0
59
1
ols
0
43
2
2유형 작성관련 질문(일반 심화)
0
39
2
2유형 작성관련 질문
0
39
2
2유형 object컬럼 개수 다르면
0
48
2
코딩팡질문이요ㅠㅠ
0
45
2
관찰값과 기대값의 개념이 헷갈립니다.
0
25
2
작업형2 ID 컬럼 삭제 질문
0
45
2





