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)로 설정해주세요
8/6 작성한 연장문의 질문글에 대한 재요청
0
13
1
수강기간 연장 문의
0
12
1
수강기간 연장문의
0
9
1
수강기간 연장 요청 문의드립니다
0
14
1
수강 기간 연장 문의
0
34
1
수강연장 가능 문의 (기간 약 한달반)
0
52
2
수강기간 연장 가능할까요 선생님
0
69
2
Section15. 수업에 사용하는 데이터 주소가 다 보이지 않아서 실습을 위한 데이터를 다운 받지 못하고 있습니다.
0
47
3
수강연장요청 문의
0
80
2
아무래도 다음 시험 연장은 어렵겠죠?
0
101
2
빅분기 12회 결과 관련 문의
0
104
1
책이랑 강의랑 순서나 예제가 다른것 같네요
0
76
2
수강연장 문의
0
102
2
재검토 요청 방법 좀 알려주셔요...-.-;;
0
100
2
12회 실기 질문(작업형 2)
0
88
2
뒤로가기 버튼 같은 것이 있나요?
0
61
1
강의 연장 문의
0
93
2
출력값 질문
0
69
2
수업노트가 어디에 있나요?
0
59
1
실기시험 제출관련
0
222
3
6.20 작업형 2 과적합
0
227
3
코딩팡 장업형2 베이스 라인 인코딩 종류 질문
0
84
2
로지스틱회귀, 회귀
0
76
2
회귀 문제를 풀때 질문입니다.
0
79
1





