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)로 설정해주세요
작업형 1 유형 부분
0
11
1
작업형 1 (삭제예정, 구 버전)
0
31
2
수강기간 연장 문의드립니다.
0
21
1
2유형 레이블 인코딩 VS 원핫 인코딩
0
24
3
수강기간 연장 문의드립니다.
0
26
1
인덱스 슬라이싱
0
27
2
질문 드립니다.
0
45
2
강의 내용 관련 질문드립니다~
0
43
2
수강 연장 문의
0
54
2
강의자료 일괄 다운로드
0
50
2
수강기간 연장 문의드립니다
0
40
2
list 문제 질문드립니다~
0
35
2
빅분기 실기 12회 재도전
0
53
2
강의 기간 연장 가능여부 검토 요청건
0
39
2
수강기간 연장 문의 드립니다
0
43
2
수강기간 연장 문의드립니다
0
50
2
질문이요
0
56
2
수강기간 연장 문의드립니다.
0
58
2
문제 3-2 질문드립니다
0
47
2
수강기간 연장 문의 드립니다.
0
61
2
변수, 칼럼 , df 구분
0
51
2
수강기간 연장 문의드립니다.
0
50
2
수강기간 연장 문의
0
49
2
수강기간 연장 문의드립니다.
0
42
2





