일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
- MS-SQL
- MySQL
- urllib
- GIT
- IOS
- 다이어트
- 맛집
- port
- PyQt
- node.js
- 유니티
- pandas
- swift
- flutter
- javascript
- python
- 함수
- 라즈베리파이
- 리눅스
- ASP
- Linux
- PER
- sqlite
- 날짜
- tensorflow
- ubuntu
- Excel
- mssql
- PyQt5
- Unity
목록2024/08/22 (2)
아미(아름다운미소)
import pandas as pd# 예시 데이터프레임 생성data = { 'a': ['x', 'x', 'y', 'y', 'x', 'y', 'x', 'y', 'x', 'y'], 'b': [1, 1, 2, 2, 1, 1, 2, 2, 1, 1], 'c': ['foo', 'foo', 'bar', 'bar', 'foo', 'foo', 'bar', 'bar', 'foo', 'foo'], 'd': [10, 10, 20, 20, 10, 10, 20, 20, 10, 10], 'e': [4, 6, 10, 15, 25, 5, 3, 8, 12, 7], 'f': ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']}df = pd.DataFrame(data)..
import pandas as pd# 예시 데이터프레임 생성data = { 'a': ['x', 'x', 'y', 'y', 'x'], 'b': [1, 1, 2, 2, 1], 'c': ['foo', 'foo', 'bar', 'bar', 'foo'], 'd': [10, 10, 20, 20, 10], 'e': [5, 15, 10, 20, 25]}df = pd.DataFrame(data)# 그룹화 후 e 컬럼의 합계와 행 수 계산result = df.groupby(['a', 'b', 'c', 'd']).agg( e_sum=('e', 'sum'), row_count=('e', 'count')).reset_index()print(result)import pandas as pd# ..